Skip to content

Conversation

@eddyp
Copy link

@eddyp eddyp commented Feb 17, 2017

Git and other clients such as SourceTree will rewrite .git/config
in the modules when checking out a branch tracking a remote branch.
The rewrite appears to be a remove then recreate operation, which
efectively removes the .git/config symlink.

As a consequence, repo sync will complain in project._CheckDirReference()
will detect the src and dst for 'config' to be different and assume there
are local changes which need not be overwritten/lost.

As a workaround, from the sync context we skip the check on the config file
to be correctly linked.

This is probabaly NOT the Right Way(TM) to fix this, but is enough to
allow the sync to work in a way which does not seem to be catastrophic
or obviously broken.

Probably the correct solution would be to remove the .repo config and
replace and re-symlink it with the one in the module itself.

Git and other clients such as SourceTree will rewrite .git/config
in the modules when checking out a branch tracking a remote branch.
The rewrite appears to be a remove then recreate operation, which
efectively removes the .git/config symlink.

As a consequence, repo sync will complain in project._CheckDirReference()
will detect the src and dst for 'config' to be different and assume there
are local changes which need not be overwritten/lost.

As a workaround, from the sync context we skip the check on the config file
to be correctly linked.

This is probabaly NOT the Right Way(TM) to fix this, but is enough to
allow the sync to work in a way which does not seem to be catastrophic
or obviously broken.

Probably the correct solution would be to remove the .repo config and
replace and re-symlink it with the one in the module itself.

Signed-off-by: Eddy Petrișor <eddy.petrisor@gmail.com>
@eddyp
Copy link
Author

eddyp commented Feb 17, 2017

This is a fix/workaround for #57

@PierreLeCorre
Copy link

PierreLeCorre commented Mar 16, 2017

Hi eddyp, i totally agree with you that this problem is important.
It is very easy to reproduce the problem:
repo start mywork
repo abandon mywork
repo sync . will leadd to the issue you mention.

You get rid of this with "rm -rf .git" and then repo sync .
And usually this end up with repo forall -c rm -rf .git

@PierreLeCorre
Copy link

Finally the Git-2.12.0-64-bit does not break the various sym link when the symlink option is choosen at install time.
As a consequence, this patch is not required.

@eddyp
Copy link
Author

eddyp commented Mar 17, 2017 via email

@PierreLeCorre
Copy link

Hi,
https://www.kernel.org/pub/software/scm/git/docs/git-config.html
core.symlinks: you can start verifying that this setting is set to true.
On our side we were on git 2.6 and the git branch -d command was breaking the symlink. This is not the case with git 2.12.
Concerning SourceTree, i don't have any knowledge on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants