git-repo icon indicating copy to clipboard operation
git-repo copied to clipboard

skip config reference check in sync

Open eddyp opened this issue 8 years ago • 5 comments

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.

eddyp avatar Feb 17 '17 20:02 eddyp

This is a fix/workaround for #57

eddyp avatar Feb 17 '17 20:02 eddyp

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 avatar Mar 16 '17 14:03 PierreLeCorre

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.

PierreLeCorre avatar Mar 16 '17 16:03 PierreLeCorre

Eddy Petrișor

Pe 16 mar. 2017 18:31, "PierreLeCorre" [email protected] a scris:

Finally the Git-2.12.0-64-bit does not break the various sym link when the symlink option is choosen at install time.

Do you know if there is an after-install option that can be set, in case is missed at install time. Do you know more info about it? Can the setting be done at project level, or are they at host level.

As a consequence, this patch is not required.

In our team there is heavy use of SourceTree, will there be a need for patch in all the git clients we use?

eddyp avatar Mar 17 '17 10:03 eddyp

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.

PierreLeCorre avatar Mar 17 '17 10:03 PierreLeCorre