git-annex/doc/bugs/Merge_involving_symlink_yields_unexpected_results.mdwn
Joey Hess ba42b67c70 Fix bug in automatic merge conflict resolution
When one side is an annexed symlink, and the other side is a non-annexed symlink.

In this case, git-merge does not replace the annexed symlink in the work
tree with the non-annexed symlink, which is different from it's handling of
conflicts between annexed symlinks and regular files or directories.
So, while git-annex generated the correct merge commit, the work tree
didn't get updated to reflect it.
See comments on bug for additional analysis.

Did not add this to the test suite yet; just unloaded a truckload of firewood
and am feeling lazy.

This commit was sponsored by Adam Spiers.
2014-07-08 13:55:11 -04:00

51 lines
1.3 KiB
Markdown

### Please describe the problem.
When creating a symlink in repository A, and creating a regular file under the same name in repository B, syncing B will yield the result that the symlink is lost, and both the original filename and the .variant file will point to the same annex object containing the original content from B.
Both A and B are indirect mode repos.
### What steps will reproduce the problem?
[[!format sh """
#Initial state:
repo-A$ echo file1
This is file 1.
repo-B$ echo file1
This is file 1.
#Make conflicting changes:
repo-A$ ln -s file1 file2; git add file2; git commit -m "Add file2 as symlink."
repo-B$ echo "This is file 2." > file2; git annex add file2; git commit -m "Add file2 as regular file."
#Sync it:
repo-A$ git annex sync
repo-B$ git annex sync
#Strange result in repo-B:
repo-B$ ls -l file2*
file2 -> .git/annex/objects/$HASH1
file2.variant1234 -> .git/annex/objects/$HASH1
repo-B$ cat file2 file2.variantXXXX
This is file 2.
This is file 2.
#Repo-A leaves the symlink change untouched and adds a .variant containing the new regular file data.
repo-A$ ls -l file*
file2 -> file1
file2.variant1234 -> .git/annex/objects/$HASH1
repo-A$ cat file.variant1234
This is file 2.
"""]]
### What version of git-annex are you using? On what operating system?
Linux 3.15.3
git-annex 5.20140613
[[!tag confirmed]]
> [[fixed|done]] --[[Joey]]