esrlabs/git-repo

(win7) local project git configuration breaks the symlink of the config file in the .git

amirhadar opened this issue · 8 comments

Any local configuration of a project within a repo causes the symlink of the config file to break and thus causes a repo sync failure.

You can recreate the problem by

repo init ...
repo sync ..
cd to one of the project
git config hello.foo boo

Now any repo sync will fail and will ask for --force-sync.

You can look at the .git directory of the project and see that the symlink of config file is gone and now the file is on its own (regular file and not a symlink).

Hi amirhadar, thank you for the request.

I dont know if we can really fix this since it is apparently git who is destroying the symlink. What version of Git do you have?

I am running into the same issue. I am using Git For Windows 2.9.2 64-bit.

c:\>git --version
git version 2.9.2.windows.1

I can workaround the problem by deleting the .git\config file and running mklink manually to restore the original symlink.

Thanks for providing the workaround. Apparently this is a known git behaviour, so I dont see an easy solution for repo to work around this: http://stackoverflow.com/questions/11786623/cant-hard-link-the-gitconfig-file .

Yes, this is indeed a bug in git for windows (git on cygwin behaves correctly).

Given that, the problem I see with the current behavior of "repo" is that the suggestion of using --force-sync is actually wrong. Every time I tried using that option, I ended up losing the whole .git subdirectory. Let me see if I can reproduce this consistently.

I think one option would be to either provide

  • a better error message
  • or maybe ensure --force-sync does actually fix things
  • or maybe even to provide a new option to repo to fix the .config files. I am thinking the "right" behavior would be to copy the content of the local .git\config file back to the location in the .repo directory, then re-create the .git\config file as a symlink.

Hi all,

Thank you all for the responses.
I would like to present my workaround which is:
In project.py method _CheckDirReference, incase src!=dst I copy the config file and re-set the symlink.

In addition I now encounter a similar problem with repo upload after creating a branch using git and not repo. Again this is due to git config destroying the symlink. I am trying now to set the project config to point to the file in the project worktree and not in the .repo. I am not sure this solution is solid. will update.
BR

I submitted a issue in the "Git For Windows" repository (git-for-windows/git#958), and it has been fixed (very quickly actually).

So, hopefully this issue will be obsolete with the next version of Git For Windows.

This issue has been fixed in Git For Windows 2.11.0 (https://github.com/git-for-windows/git/releases/tag/v2.11.0.windows.1)

Yay, cool @rpaquay , thanks ! :)