summaryrefslogtreecommitdiff
path: root/doc/bugs/data_loss:_incorrect_merge_upon_conflicting_directory-file_of_direct_repos.mdwn
blob: 8007ae11fe9547818893fa0992d85dbeb0678e4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
### Please describe the problem.
Data loss due to incorrect merge of repos in direct mode. (I tested the same scenario in indirect mode and it worked fine there)

Given 2 repos A and B, in direct mode:

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.

Expected result: remaining contents: f.variant-AAA which is file f of B, f.variant-BBB which is directory f of A, containing a file f. Merge conflict marked resolved.

### 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

"""]]

> Bug fixed; test case added; [[done]] --[[Joey]]