This commit is contained in:
https://www.google.com/accounts/o8/id?id=AItOawlWskoNgUB7r70OXglR-4iKI4bOuPJb-xg 2013-10-12 20:13:39 +00:00 committed by admin
parent c8ab2f1fce
commit 13649750b8

View file

@ -0,0 +1,194 @@
### Please describe the problem.
Data loss due to incorrect merge of repos in direct mode.
Given 2 repos A and B, in direct mode, where a has no remotes and b has a as remote (not sure if the latter is relevant):
1. in A: mkdir f, with a file f in it
2. in B: touch f
3. in B: sync
Result: Only an f.variant-f###remains, which is file f of B, and the merge conflict has already been automatically resolved. I.e. Directory f containing file f, is lost.
### What steps will reproduce the problem?
Execute the script given below in additional information.
### What version of git-annex are you using?
git-annex version: 4.20130911-g6625d0e
build flags: Assistant Webapp Pairing Testsuite S3 WebDAV Inotify DBus XMPP Feeds Quvi
### On what operating system?
Linux basementcat 3.10.10-1-ARCH #1 SMP PREEMPT Fri Aug 30 11:30:06 CEST 2013 x86_64 GNU/Linux
### Please provide any additional information below.
[[!format sh """
[~]$ mkdir test
[~/test]$ mkdir a
[~/test/a]$ git init
Initialized empty Git repository in /home/limyreth/test/a/.git/
[~/test/a]$ git annex init test
init test ok
(Recording state in git...)
[~/test/a]$ touch firstfile
[~/test/a]$ git annex add firstfile
add firstfile (checksum...) ok
(Recording state in git...)
[~/test/a]$ git annex sync
commit
ok
git-annex: no branch is checked out
[~]$ git clone test/a
Cloning into 'a'...
done.
[~]$ mv a test/b
[~/test/a]$ git annex direct
commit
# On branch master
nothing to commit, working directory clean
ok
direct firstfile ok
direct ok
[~/test/a]$ ls -l
total 0
-rw-r--r-- 1 limyreth users 0 Oct 12 15:09 firstfile
[~/test/a]$ mkdir f
[~/test/a]$ touch f/f
[~/test/a]$ git annex add f/f
add f/f (checksum...) ok
(Recording state in git...)
[~/test/a]$ git annex sync
commit
ok
[~/test/b]$ git remote -v
origin /home/limyreth/test/a (fetch)
origin /home/limyreth/test/a (push)
[~/test/b]$ ls
firstfile
[~/test/b]$ git annex direct
commit
(Recording state in git...)
# On branch master
nothing to commit, working directory clean
ok
direct ok
[~/test/b]$ touch f
[~/test/b]$ git annex add f
add f (checksum...) ok
(Recording state in git...)
[~/test/b]$ git annex sync
(merging origin/git-annex into git-annex...)
(Recording state in git...)
commit
ok
pull origin
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 9 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (9/9), done.
From /home/limyreth/test/a
2a8fa45..ad6802d master -> origin/master
1f39016..19e3e12 git-annex -> origin/git-annex
* [new branch] synced/master -> origin/synced/master
Adding f/f
CONFLICT (file/directory): There is a directory with name f in refs/remotes/origin/master. Adding f as f~HEAD
Automatic merge failed; fix conflicts and then commit the result.
f: needs merge
(Recording state in git...)
ok
[master 37a8019] git-annex automatic merge conflict fix
Already up-to-date.
ok
(merging origin/git-annex into git-annex...)
(Recording state in git...)
push origin
Counting objects: 36, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (25/25), 2.16 KiB | 0 bytes/s, done.
Total 25 (delta 5), reused 0 (delta 0)
To /home/limyreth/test/a
ad6802d..37a8019 master -> synced/master
* [new branch] git-annex -> synced/git-annex
ok
[~/test/b]$ ls -l
total 0
-rw-r--r-- 1 limyreth users 0 Oct 12 15:11 firstfile
-rw-r--r-- 1 limyreth users 0 Oct 12 15:11 f.variant-f874
[~/test/b]$ git log --summary
commit 37a80199abe3cf82100bbdb5dd2217ed6bcb4b62
Merge: 5a8942a ad6802d
Author: timdiels <timdiels.m@gmail.com>
Date: Sat Oct 12 15:11:47 2013 +0200
git-annex automatic merge conflict fix
commit 5a8942a9a1735cb313c1f6624cbd3f48b252d9d9
Author: timdiels <timdiels.m@gmail.com>
Date: Sat Oct 12 15:11:47 2013 +0200
git-annex automatic sync
create mode 120000 f
commit ad6802dc231d389b86154e2df900a70b18e17b29
Author: timdiels <timdiels.m@gmail.com>
Date: Sat Oct 12 15:11:40 2013 +0200
git-annex automatic sync
create mode 120000 f/f
commit 2a8fa45bea996ab5ae219a017d4b642153e6d9c9
Author: timdiels <timdiels.m@gmail.com>
Date: Sat Oct 12 15:09:40 2013 +0200
git-annex automatic sync
create mode 120000 firstfile
[~/test/a]$ git annex sync
(merging synced/git-annex into git-annex...)
commit
ok
merge synced/master
Updating ad6802d..37a8019
Fast-forward
f.variant-f874 | 1 +
f/f | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
create mode 120000 f.variant-f874
delete mode 120000 f/f
ok
[~/test/a]$ git log --summary
commit 37a80199abe3cf82100bbdb5dd2217ed6bcb4b62
Merge: 5a8942a ad6802d
Author: timdiels <timdiels.m@gmail.com>
Date: Sat Oct 12 15:11:47 2013 +0200
git-annex automatic merge conflict fix
commit 5a8942a9a1735cb313c1f6624cbd3f48b252d9d9
Author: timdiels <timdiels.m@gmail.com>
Date: Sat Oct 12 15:11:47 2013 +0200
git-annex automatic sync
create mode 120000 f
commit ad6802dc231d389b86154e2df900a70b18e17b29
Author: timdiels <timdiels.m@gmail.com>
Date: Sat Oct 12 15:11:40 2013 +0200
git-annex automatic sync
create mode 120000 f/f
commit 2a8fa45bea996ab5ae219a017d4b642153e6d9c9
Author: timdiels <timdiels.m@gmail.com>
Date: Sat Oct 12 15:09:40 2013 +0200
git-annex automatic sync
create mode 120000 firstfile
"""]]