git-new-workdir should not share .git/rr-cache/MERGE_RR
- From
- Kalle Olavi Niemitalo <kon@iki.fi>
- Date
- Jul 12, 2008, 11:27 UTC
- Message-ID
- <87skufmjg4.fsf@Astalo.kon.iki.fi>
The contrib/workdir/git-new-workdir script makes .git/rr-cache in each workdir a symlink to the shared .git/rr-cache directory. This lets git-rerere share conflict resolutions between workdirs. However, that directory also contains .git/rr-cache/MERGE_RR, which lists the files for which conflict resolutions should be saved in the next commit. It is thus possible that git-merge in one workdir records conflicts to the shared MERGE_RR file, and git-commit in another workdir saves the staged files to rr-cache as conflict resolutions, even though those files are from a different branch and never saw the merge. Such invalid conflict resolutions need then be separately deleted. This happened to me, with git version 1.5.6.
I don't see any way to modify the symlinks made by git-new-workdir so that new SHA-1 directories in .git/rr-cache would be shared but .git/rr-cache/MERGE_RR would not. On IRC, "gitte" suggested changing Git to use $GIT_DIR/MERGE_RR instead of $GIT_DIR/rr-cache/MERGE_RR. I suppose compatibility with people's existing repositories would require the modified Git to keep reading $GIT_DIR/rr-cache/MERGE_RR too, so that Git could be painlessly upgraded during a merge, but it is not obvious to me how lock files should then work.
Alternatively, the SHA-1 directories in .git/rr-cache could be moved to a subdirectory; then git-new-workdir could be changed to symlink only that subdirectory.