~ubuntu-branches/debian/sid/git/sid

« back to all changes in this revision

Viewing changes to t/t4300-merge-tree.sh

  • Committer: Package Import Robot
  • Author(s): Jonathan Nieder
  • Date: 2013-06-12 07:50:53 UTC
  • mfrom: (1.2.19) (2.1.31 experimental)
  • Revision ID: package-import@ubuntu.com-20130612075053-uue9xe0dq0rvm44y
Tags: 1:1.8.3.1-1
* merge branch debian-experimental
* new upstream point release (see RelNotes/1.8.3.1.txt).
* debian/watch: use xz-compressed tarballs from kernel.org.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
test_expect_success 'file add !A, B' '
28
28
        cat >expected <<\EXPECTED &&
29
 
added in local
30
 
  our    100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE
31
29
EXPECTED
32
30
 
33
31
        git reset --hard initial &&
38
36
 
39
37
test_expect_success 'file add A, B (same)' '
40
38
        cat >expected <<\EXPECTED &&
41
 
added in both
42
 
  our    100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE
43
 
  their  100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE
44
39
EXPECTED
45
40
 
46
41
        git reset --hard initial &&
181
176
 
182
177
test_expect_success 'file remove A, !B' '
183
178
        cat >expected <<\EXPECTED &&
184
 
removed in local
185
 
  base   100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE
186
 
  their  100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE
187
179
EXPECTED
188
180
 
189
181
        git reset --hard initial &&
213
205
        test_cmp expected actual
214
206
'
215
207
 
 
208
test_expect_success 'file remove A, B (same)' '
 
209
        cat >expected <<\EXPECTED &&
 
210
EXPECTED
 
211
 
 
212
        git reset --hard initial &&
 
213
        test_commit "rm-a-b-base" "ONE" "AAA" &&
 
214
        git rm ONE &&
 
215
        git commit -m "rm-a-b" &&
 
216
        git tag "rm-a-b" &&
 
217
        git merge-tree rm-a-b-base rm-a-b rm-a-b >actual &&
 
218
        test_cmp expected actual
 
219
'
 
220
 
216
221
test_expect_success 'file change A, remove B' '
217
222
        cat >expected <<\EXPECTED &&
218
223
removed in remote
254
259
        test_cmp expected actual
255
260
'
256
261
 
 
262
test_expect_success 'tree add A, B (same)' '
 
263
        cat >expect <<-\EOF &&
 
264
        EOF
 
265
        git reset --hard initial &&
 
266
        mkdir sub &&
 
267
        test_commit "add sub/file" "sub/file" "file" add-tree-A &&
 
268
        git merge-tree initial add-tree-A add-tree-A >actual &&
 
269
        test_cmp expect actual
 
270
'
 
271
 
 
272
test_expect_success 'tree add A, B (different)' '
 
273
        cat >expect <<-\EOF &&
 
274
        added in both
 
275
          our    100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
 
276
          their  100644 ba629238ca89489f2b350e196ca445e09d8bb834 sub/file
 
277
        @@ -1 +1,5 @@
 
278
        +<<<<<<< .our
 
279
         AAA
 
280
        +=======
 
281
        +BBB
 
282
        +>>>>>>> .their
 
283
        EOF
 
284
        git reset --hard initial &&
 
285
        mkdir sub &&
 
286
        test_commit "add sub/file" "sub/file" "AAA" add-tree-a-b-A &&
 
287
        git reset --hard initial &&
 
288
        mkdir sub &&
 
289
        test_commit "add sub/file" "sub/file" "BBB" add-tree-a-b-B &&
 
290
        git merge-tree initial add-tree-a-b-A add-tree-a-b-B >actual &&
 
291
        test_cmp expect actual
 
292
'
 
293
 
 
294
test_expect_success 'tree unchanged A, removed B' '
 
295
        cat >expect <<-\EOF &&
 
296
        removed in remote
 
297
          base   100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
 
298
          our    100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
 
299
        @@ -1 +0,0 @@
 
300
        -AAA
 
301
        EOF
 
302
        git reset --hard initial &&
 
303
        mkdir sub &&
 
304
        test_commit "add sub/file" "sub/file" "AAA" tree-remove-b-initial &&
 
305
        git rm sub/file &&
 
306
        test_tick &&
 
307
        git commit -m "remove sub/file" &&
 
308
        git tag tree-remove-b-B &&
 
309
        git merge-tree tree-remove-b-initial tree-remove-b-initial tree-remove-b-B >actual &&
 
310
        test_cmp expect actual
 
311
'
 
312
 
 
313
test_expect_success 'turn file to tree' '
 
314
        git reset --hard initial &&
 
315
        rm initial-file &&
 
316
        mkdir initial-file &&
 
317
        test_commit "turn-file-to-tree" "initial-file/ONE" "CCC" &&
 
318
        git merge-tree initial initial turn-file-to-tree >actual &&
 
319
        cat >expect <<-\EOF &&
 
320
        added in remote
 
321
          their  100644 43aa4fdec31eb92e1fdc2f0ce6ea9ddb7c32bcf7 initial-file/ONE
 
322
        @@ -0,0 +1 @@
 
323
        +CCC
 
324
        removed in remote
 
325
          base   100644 e79c5e8f964493290a409888d5413a737e8e5dd5 initial-file
 
326
          our    100644 e79c5e8f964493290a409888d5413a737e8e5dd5 initial-file
 
327
        @@ -1 +0,0 @@
 
328
        -initial
 
329
        EOF
 
330
        test_cmp expect actual
 
331
'
 
332
 
 
333
test_expect_success 'turn tree to file' '
 
334
        git reset --hard initial &&
 
335
        mkdir dir &&
 
336
        test_commit "add-tree" "dir/path" "AAA" &&
 
337
        test_commit "add-another-tree" "dir/another" "BBB" &&
 
338
        rm -fr dir &&
 
339
        test_commit "make-file" "dir" "CCC" &&
 
340
        git merge-tree add-tree add-another-tree make-file >actual &&
 
341
        cat >expect <<-\EOF &&
 
342
        removed in remote
 
343
          base   100644 43d5a8ed6ef6c00ff775008633f95787d088285d dir/path
 
344
          our    100644 43d5a8ed6ef6c00ff775008633f95787d088285d dir/path
 
345
        @@ -1 +0,0 @@
 
346
        -AAA
 
347
        added in remote
 
348
          their  100644 43aa4fdec31eb92e1fdc2f0ce6ea9ddb7c32bcf7 dir
 
349
        @@ -0,0 +1 @@
 
350
        +CCC
 
351
        EOF
 
352
        test_cmp expect actual
 
353
'
 
354
 
257
355
test_done