t4129: don't fail if setgid is set in the test directory
[git] / t / t9350-fast-export.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2007 Johannes E. Schindelin
4 #
5
6 test_description='git fast-export'
7 . ./test-lib.sh
8
9 test_expect_success 'setup' '
10
11         echo break it > file0 &&
12         git add file0 &&
13         test_tick &&
14         echo Wohlauf > file &&
15         git add file &&
16         test_tick &&
17         git commit -m initial &&
18         echo die Luft > file &&
19         echo geht frisch > file2 &&
20         git add file file2 &&
21         test_tick &&
22         git commit -m second &&
23         echo und > file2 &&
24         test_tick &&
25         git commit -m third file2 &&
26         test_tick &&
27         git tag rein &&
28         git checkout -b wer HEAD^ &&
29         echo lange > file2 &&
30         test_tick &&
31         git commit -m sitzt file2 &&
32         test_tick &&
33         git tag -a -m valentin muss &&
34         git merge -s ours master
35
36 '
37
38 test_expect_success 'fast-export | fast-import' '
39
40         MASTER=$(git rev-parse --verify master) &&
41         REIN=$(git rev-parse --verify rein) &&
42         WER=$(git rev-parse --verify wer) &&
43         MUSS=$(git rev-parse --verify muss) &&
44         mkdir new &&
45         git --git-dir=new/.git init &&
46         git fast-export --all >actual &&
47         (cd new &&
48          git fast-import &&
49          test $MASTER = $(git rev-parse --verify refs/heads/master) &&
50          test $REIN = $(git rev-parse --verify refs/tags/rein) &&
51          test $WER = $(git rev-parse --verify refs/heads/wer) &&
52          test $MUSS = $(git rev-parse --verify refs/tags/muss)) <actual
53
54 '
55
56 test_expect_success 'fast-export ^muss^{commit} muss' '
57         git fast-export --tag-of-filtered-object=rewrite ^muss^{commit} muss >actual &&
58         cat >expected <<-EOF &&
59         tag muss
60         from $(git rev-parse --verify muss^{commit})
61         $(git cat-file tag muss | grep tagger)
62         data 9
63         valentin
64
65         EOF
66         test_cmp expected actual
67 '
68
69 test_expect_success 'fast-export --mark-tags ^muss^{commit} muss' '
70         git fast-export --mark-tags --tag-of-filtered-object=rewrite ^muss^{commit} muss >actual &&
71         cat >expected <<-EOF &&
72         tag muss
73         mark :1
74         from $(git rev-parse --verify muss^{commit})
75         $(git cat-file tag muss | grep tagger)
76         data 9
77         valentin
78
79         EOF
80         test_cmp expected actual
81 '
82
83 test_expect_success 'fast-export master~2..master' '
84
85         git fast-export master~2..master >actual &&
86         sed "s/master/partial/" actual |
87                 (cd new &&
88                  git fast-import &&
89                  test $MASTER != $(git rev-parse --verify refs/heads/partial) &&
90                  git diff --exit-code master partial &&
91                  git diff --exit-code master^ partial^ &&
92                  test_must_fail git rev-parse partial~2)
93
94 '
95
96 test_expect_success 'fast-export --reference-excluded-parents master~2..master' '
97
98         git fast-export --reference-excluded-parents master~2..master >actual &&
99         grep commit.refs/heads/master actual >commit-count &&
100         test_line_count = 2 commit-count &&
101         sed "s/master/rewrite/" actual |
102                 (cd new &&
103                  git fast-import &&
104                  test $MASTER = $(git rev-parse --verify refs/heads/rewrite))
105 '
106
107 test_expect_success 'fast-export --show-original-ids' '
108
109         git fast-export --show-original-ids master >output &&
110         grep ^original-oid output| sed -e s/^original-oid.// | sort >actual &&
111         git rev-list --objects master muss >objects-and-names &&
112         awk "{print \$1}" objects-and-names | sort >commits-trees-blobs &&
113         comm -23 actual commits-trees-blobs >unfound &&
114         test_must_be_empty unfound
115 '
116
117 test_expect_success 'fast-export --show-original-ids | git fast-import' '
118
119         git fast-export --show-original-ids master muss | git fast-import --quiet &&
120         test $MASTER = $(git rev-parse --verify refs/heads/master) &&
121         test $MUSS = $(git rev-parse --verify refs/tags/muss)
122 '
123
124 test_expect_success 'reencoding iso-8859-7' '
125
126         test_when_finished "git reset --hard HEAD~1" &&
127         test_config i18n.commitencoding iso-8859-7 &&
128         test_tick &&
129         echo rosten >file &&
130         git commit -s -F "$TEST_DIRECTORY/t9350/simple-iso-8859-7-commit-message.txt" file &&
131         git fast-export --reencode=yes wer^..wer >iso-8859-7.fi &&
132         sed "s/wer/i18n/" iso-8859-7.fi |
133                 (cd new &&
134                  git fast-import &&
135                  # The commit object, if not re-encoded, would be 200 bytes plus hash.
136                  # Removing the "encoding iso-8859-7\n" header drops 20 bytes.
137                  # Re-encoding the Pi character from \xF0 (\360) in iso-8859-7
138                  # to \xCF\x80 (\317\200) in UTF-8 adds a byte.  Check for
139                  # the expected size.
140                  test $(($(test_oid hexsz) + 181)) -eq "$(git cat-file -s i18n)" &&
141                  # ...and for the expected translation of bytes.
142                  git cat-file commit i18n >actual &&
143                  grep $(printf "\317\200") actual &&
144                  # Also make sure the commit does not have the "encoding" header
145                  ! grep ^encoding actual)
146 '
147
148 test_expect_success 'aborting on iso-8859-7' '
149
150         test_when_finished "git reset --hard HEAD~1" &&
151         test_config i18n.commitencoding iso-8859-7 &&
152         echo rosten >file &&
153         git commit -s -F "$TEST_DIRECTORY/t9350/simple-iso-8859-7-commit-message.txt" file &&
154         test_must_fail git fast-export --reencode=abort wer^..wer >iso-8859-7.fi
155 '
156
157 test_expect_success 'preserving iso-8859-7' '
158
159         test_when_finished "git reset --hard HEAD~1" &&
160         test_config i18n.commitencoding iso-8859-7 &&
161         echo rosten >file &&
162         git commit -s -F "$TEST_DIRECTORY/t9350/simple-iso-8859-7-commit-message.txt" file &&
163         git fast-export --reencode=no wer^..wer >iso-8859-7.fi &&
164         sed "s/wer/i18n-no-recoding/" iso-8859-7.fi |
165                 (cd new &&
166                  git fast-import &&
167                  # The commit object, if not re-encoded, is 200 bytes plus hash.
168                  # Removing the "encoding iso-8859-7\n" header would drops 20
169                  # bytes.  Re-encoding the Pi character from \xF0 (\360) in
170                  # iso-8859-7 to \xCF\x80 (\317\200) in UTF-8 adds a byte.
171                  # Check for the expected size...
172                  test $(($(test_oid hexsz) + 200)) -eq "$(git cat-file -s i18n-no-recoding)" &&
173                  # ...as well as the expected byte.
174                  git cat-file commit i18n-no-recoding >actual &&
175                  grep $(printf "\360") actual &&
176                  # Also make sure the commit has the "encoding" header
177                  grep ^encoding actual)
178 '
179
180 test_expect_success 'encoding preserved if reencoding fails' '
181
182         test_when_finished "git reset --hard HEAD~1" &&
183         test_config i18n.commitencoding iso-8859-7 &&
184         echo rosten >file &&
185         git commit -s -F "$TEST_DIRECTORY/t9350/broken-iso-8859-7-commit-message.txt" file &&
186         git fast-export --reencode=yes wer^..wer >iso-8859-7.fi &&
187         sed "s/wer/i18n-invalid/" iso-8859-7.fi |
188                 (cd new &&
189                  git fast-import &&
190                  git cat-file commit i18n-invalid >actual &&
191                  # Make sure the commit still has the encoding header
192                  grep ^encoding actual &&
193                  # Verify that the commit has the expected size; i.e.
194                  # that no bytes were re-encoded to a different encoding.
195                  test $(($(test_oid hexsz) + 212)) -eq "$(git cat-file -s i18n-invalid)" &&
196                  # ...and check for the original special bytes
197                  grep $(printf "\360") actual &&
198                  grep $(printf "\377") actual)
199 '
200
201 test_expect_success 'import/export-marks' '
202
203         git checkout -b marks master &&
204         git fast-export --export-marks=tmp-marks HEAD &&
205         test -s tmp-marks &&
206         test_line_count = 3 tmp-marks &&
207         git fast-export --import-marks=tmp-marks \
208                 --export-marks=tmp-marks HEAD >actual &&
209         test $(grep ^commit actual | wc -l) -eq 0 &&
210         echo change > file &&
211         git commit -m "last commit" file &&
212         git fast-export --import-marks=tmp-marks \
213                 --export-marks=tmp-marks HEAD >actual &&
214         test $(grep ^commit\  actual | wc -l) -eq 1 &&
215         test_line_count = 4 tmp-marks
216
217 '
218
219 cat > signed-tag-import << EOF
220 tag sign-your-name
221 from $(git rev-parse HEAD)
222 tagger C O Mitter <committer@example.com> 1112911993 -0700
223 data 210
224 A message for a sign
225 -----BEGIN PGP SIGNATURE-----
226 Version: GnuPG v1.4.5 (GNU/Linux)
227
228 fakedsignaturefakedsignaturefakedsignaturefakedsignaturfakedsign
229 aturefakedsignaturefake=
230 =/59v
231 -----END PGP SIGNATURE-----
232 EOF
233
234 test_expect_success 'set up faked signed tag' '
235
236         cat signed-tag-import | git fast-import
237
238 '
239
240 test_expect_success 'signed-tags=abort' '
241
242         test_must_fail git fast-export --signed-tags=abort sign-your-name
243
244 '
245
246 test_expect_success 'signed-tags=verbatim' '
247
248         git fast-export --signed-tags=verbatim sign-your-name > output &&
249         grep PGP output
250
251 '
252
253 test_expect_success 'signed-tags=strip' '
254
255         git fast-export --signed-tags=strip sign-your-name > output &&
256         ! grep PGP output
257
258 '
259
260 test_expect_success 'signed-tags=warn-strip' '
261         git fast-export --signed-tags=warn-strip sign-your-name >output 2>err &&
262         ! grep PGP output &&
263         test -s err
264 '
265
266 test_expect_success 'setup submodule' '
267
268         git checkout -f master &&
269         mkdir sub &&
270         (
271                 cd sub &&
272                 git init  &&
273                 echo test file > file &&
274                 git add file &&
275                 git commit -m sub_initial
276         ) &&
277         git submodule add "$(pwd)/sub" sub &&
278         git commit -m initial &&
279         test_tick &&
280         (
281                 cd sub &&
282                 echo more data >> file &&
283                 git add file &&
284                 git commit -m sub_second
285         ) &&
286         git add sub &&
287         git commit -m second
288
289 '
290
291 test_expect_success 'submodule fast-export | fast-import' '
292
293         SUBENT1=$(git ls-tree master^ sub) &&
294         SUBENT2=$(git ls-tree master sub) &&
295         rm -rf new &&
296         mkdir new &&
297         git --git-dir=new/.git init &&
298         git fast-export --signed-tags=strip --all >actual &&
299         (cd new &&
300          git fast-import &&
301          test "$SUBENT1" = "$(git ls-tree refs/heads/master^ sub)" &&
302          test "$SUBENT2" = "$(git ls-tree refs/heads/master sub)" &&
303          git checkout master &&
304          git submodule init &&
305          git submodule update &&
306          cmp sub/file ../sub/file) <actual
307
308 '
309
310 GIT_AUTHOR_NAME='A U Thor'; export GIT_AUTHOR_NAME
311 GIT_COMMITTER_NAME='C O Mitter'; export GIT_COMMITTER_NAME
312
313 test_expect_success 'setup copies' '
314
315         git checkout -b copy rein &&
316         git mv file file3 &&
317         git commit -m move1 &&
318         test_tick &&
319         cp file2 file4 &&
320         git add file4 &&
321         git mv file2 file5 &&
322         git commit -m copy1 &&
323         test_tick &&
324         cp file3 file6 &&
325         git add file6 &&
326         git commit -m copy2 &&
327         test_tick &&
328         echo more text >> file6 &&
329         echo even more text >> file6 &&
330         git add file6 &&
331         git commit -m modify &&
332         test_tick &&
333         cp file6 file7 &&
334         echo test >> file7 &&
335         git add file7 &&
336         git commit -m copy_modify
337
338 '
339
340 test_expect_success 'fast-export -C -C | fast-import' '
341
342         ENTRY=$(git rev-parse --verify copy) &&
343         rm -rf new &&
344         mkdir new &&
345         git --git-dir=new/.git init &&
346         git fast-export -C -C --signed-tags=strip --all > output &&
347         grep "^C file2 file4\$" output &&
348         cat output |
349         (cd new &&
350          git fast-import &&
351          test $ENTRY = $(git rev-parse --verify refs/heads/copy))
352
353 '
354
355 test_expect_success 'fast-export | fast-import when master is tagged' '
356
357         git tag -m msg last &&
358         git fast-export -C -C --signed-tags=strip --all > output &&
359         test $(grep -c "^tag " output) = 3
360
361 '
362
363 cat > tag-content << EOF
364 object $(git rev-parse HEAD)
365 type commit
366 tag rosten
367 EOF
368
369 test_expect_success 'cope with tagger-less tags' '
370
371         TAG=$(git hash-object -t tag -w tag-content) &&
372         git update-ref refs/tags/sonnenschein $TAG &&
373         git fast-export -C -C --signed-tags=strip --all > output &&
374         test $(grep -c "^tag " output) = 4 &&
375         ! grep "Unspecified Tagger" output &&
376         git fast-export -C -C --signed-tags=strip --all \
377                 --fake-missing-tagger > output &&
378         test $(grep -c "^tag " output) = 4 &&
379         grep "Unspecified Tagger" output
380
381 '
382
383 test_expect_success 'setup for limiting exports by PATH' '
384         mkdir limit-by-paths &&
385         (
386                 cd limit-by-paths &&
387                 git init &&
388                 echo hi > there &&
389                 git add there &&
390                 git commit -m "First file" &&
391                 echo foo > bar &&
392                 git add bar &&
393                 git commit -m "Second file" &&
394                 git tag -a -m msg mytag &&
395                 echo morefoo >> bar &&
396                 git add bar &&
397                 git commit -m "Change to second file"
398         )
399 '
400
401 cat > limit-by-paths/expected << EOF
402 blob
403 mark :1
404 data 3
405 hi
406
407 reset refs/tags/mytag
408 commit refs/tags/mytag
409 mark :2
410 author A U Thor <author@example.com> 1112912713 -0700
411 committer C O Mitter <committer@example.com> 1112912713 -0700
412 data 11
413 First file
414 M 100644 :1 there
415
416 EOF
417
418 test_expect_success 'dropping tag of filtered out object' '
419 (
420         cd limit-by-paths &&
421         git fast-export --tag-of-filtered-object=drop mytag -- there > output &&
422         test_cmp expected output
423 )
424 '
425
426 cat >> limit-by-paths/expected << EOF
427 tag mytag
428 from :2
429 tagger C O Mitter <committer@example.com> 1112912713 -0700
430 data 4
431 msg
432
433 EOF
434
435 test_expect_success 'rewriting tag of filtered out object' '
436 (
437         cd limit-by-paths &&
438         git fast-export --tag-of-filtered-object=rewrite mytag -- there > output &&
439         test_cmp expected output
440 )
441 '
442
443 test_expect_success 'rewrite tag predating pathspecs to nothing' '
444         test_create_repo rewrite_tag_predating_pathspecs &&
445         (
446                 cd rewrite_tag_predating_pathspecs &&
447
448                 test_commit initial &&
449
450                 git tag -a -m "Some old tag" v0.0.0.0.0.0.1 &&
451
452                 test_commit bar &&
453
454                 git fast-export --tag-of-filtered-object=rewrite --all -- bar.t >output &&
455                 grep from.$ZERO_OID output
456         )
457 '
458
459 cat > limit-by-paths/expected << EOF
460 blob
461 mark :1
462 data 4
463 foo
464
465 blob
466 mark :2
467 data 3
468 hi
469
470 reset refs/heads/master
471 commit refs/heads/master
472 mark :3
473 author A U Thor <author@example.com> 1112912713 -0700
474 committer C O Mitter <committer@example.com> 1112912713 -0700
475 data 12
476 Second file
477 M 100644 :1 bar
478 M 100644 :2 there
479
480 EOF
481
482 test_expect_failure 'no exact-ref revisions included' '
483         (
484                 cd limit-by-paths &&
485                 git fast-export master~2..master~1 > output &&
486                 test_cmp expected output
487         )
488 '
489
490 test_expect_success 'path limiting with import-marks does not lose unmodified files'        '
491         git checkout -b simple marks~2 &&
492         git fast-export --export-marks=marks simple -- file > /dev/null &&
493         echo more content >> file &&
494         test_tick &&
495         git commit -mnext file &&
496         git fast-export --import-marks=marks simple -- file file0 >actual &&
497         grep file0 actual
498 '
499
500 test_expect_success 'avoid corrupt stream with non-existent mark' '
501         test_create_repo avoid_non_existent_mark &&
502         (
503                 cd avoid_non_existent_mark &&
504
505                 test_commit important-path &&
506
507                 test_commit ignored &&
508
509                 git branch A &&
510                 git branch B &&
511
512                 echo foo >>important-path.t &&
513                 git add important-path.t &&
514                 test_commit more changes &&
515
516                 git fast-export --all -- important-path.t | git fast-import --force
517         )
518 '
519
520 test_expect_success 'full-tree re-shows unmodified files'        '
521         git checkout -f simple &&
522         git fast-export --full-tree simple >actual &&
523         test $(grep -c file0 actual) -eq 3
524 '
525
526 test_expect_success 'set-up a few more tags for tag export tests' '
527         git checkout -f master &&
528         HEAD_TREE=$(git show -s --pretty=raw HEAD | grep tree | sed "s/tree //") &&
529         git tag    tree_tag        -m "tagging a tree" $HEAD_TREE &&
530         git tag -a tree_tag-obj    -m "tagging a tree" $HEAD_TREE &&
531         git tag    tag-obj_tag     -m "tagging a tag" tree_tag-obj &&
532         git tag -a tag-obj_tag-obj -m "tagging a tag" tree_tag-obj
533 '
534
535 test_expect_success 'tree_tag'        '
536         mkdir result &&
537         (cd result && git init) &&
538         git fast-export tree_tag > fe-stream &&
539         (cd result && git fast-import < ../fe-stream)
540 '
541
542 # NEEDSWORK: not just check return status, but validate the output
543 # Note that these tests DO NOTHING other than print a warning that
544 # they are omitting the one tag we asked them to export (because the
545 # tags resolve to a tree).  They exist just to make sure we do not
546 # abort but instead just warn.
547 test_expect_success 'tree_tag-obj'    'git fast-export tree_tag-obj'
548 test_expect_success 'tag-obj_tag'     'git fast-export tag-obj_tag'
549 test_expect_success 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
550
551 test_expect_success 'handling tags of blobs' '
552         git tag -a -m "Tag of a blob" blobtag $(git rev-parse master:file) &&
553         git fast-export blobtag >actual &&
554         cat >expect <<-EOF &&
555         blob
556         mark :1
557         data 9
558         die Luft
559
560         tag blobtag
561         from :1
562         tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
563         data 14
564         Tag of a blob
565
566         EOF
567         test_cmp expect actual
568 '
569
570 test_expect_success 'handling nested tags' '
571         git tag -a -m "This is a nested tag" nested muss &&
572         git fast-export --mark-tags nested >output &&
573         grep "^from $ZERO_OID$" output &&
574         grep "^tag nested$" output >tag_lines &&
575         test_line_count = 2 tag_lines
576 '
577
578 test_expect_success 'directory becomes symlink'        '
579         git init dirtosymlink &&
580         git init result &&
581         (
582                 cd dirtosymlink &&
583                 mkdir foo &&
584                 mkdir bar &&
585                 echo hello > foo/world &&
586                 echo hello > bar/world &&
587                 git add foo/world bar/world &&
588                 git commit -q -mone &&
589                 git rm -r foo &&
590                 test_ln_s_add bar foo &&
591                 git commit -q -mtwo
592         ) &&
593         (
594                 cd dirtosymlink &&
595                 git fast-export master -- foo |
596                 (cd ../result && git fast-import --quiet)
597         ) &&
598         (cd result && git show master:foo)
599 '
600
601 test_expect_success 'fast-export quotes pathnames' '
602         git init crazy-paths &&
603         test_config -C crazy-paths core.protectNTFS false &&
604         (cd crazy-paths &&
605          blob=$(echo foo | git hash-object -w --stdin) &&
606          git -c core.protectNTFS=false update-index --add \
607                 --cacheinfo 100644 $blob "$(printf "path with\\nnewline")" \
608                 --cacheinfo 100644 $blob "path with \"quote\"" \
609                 --cacheinfo 100644 $blob "path with \\backslash" \
610                 --cacheinfo 100644 $blob "path with space" &&
611          git commit -m addition &&
612          git ls-files -z -s | perl -0pe "s{\\t}{$&subdir/}" >index &&
613          git read-tree --empty &&
614          git update-index -z --index-info <index &&
615          git commit -m rename &&
616          git read-tree --empty &&
617          git commit -m deletion &&
618          git fast-export -M HEAD >export.out &&
619          git rev-list HEAD >expect &&
620          git init result &&
621          cd result &&
622          git fast-import <../export.out &&
623          git rev-list HEAD >actual &&
624          test_cmp ../expect actual
625         )
626 '
627
628 test_expect_success 'test bidirectionality' '
629         git init marks-test &&
630         git fast-export --export-marks=marks-cur --import-marks-if-exists=marks-cur --branches | \
631         git --git-dir=marks-test/.git fast-import --export-marks=marks-new --import-marks-if-exists=marks-new &&
632         (cd marks-test &&
633         git reset --hard &&
634         echo Wohlauf > file &&
635         git commit -a -m "back in time") &&
636         git --git-dir=marks-test/.git fast-export --export-marks=marks-new --import-marks-if-exists=marks-new --branches | \
637         git fast-import --export-marks=marks-cur --import-marks-if-exists=marks-cur
638 '
639
640 cat > expected << EOF
641 blob
642 mark :13
643 data 5
644 bump
645
646 commit refs/heads/master
647 mark :14
648 author A U Thor <author@example.com> 1112912773 -0700
649 committer C O Mitter <committer@example.com> 1112912773 -0700
650 data 5
651 bump
652 from :12
653 M 100644 :13 file
654
655 EOF
656
657 test_expect_success 'avoid uninteresting refs' '
658         > tmp-marks &&
659         git fast-export --import-marks=tmp-marks \
660                 --export-marks=tmp-marks master > /dev/null &&
661         git tag v1.0 &&
662         git branch uninteresting &&
663         echo bump > file &&
664         git commit -a -m bump &&
665         git fast-export --import-marks=tmp-marks \
666                 --export-marks=tmp-marks ^uninteresting ^v1.0 master > actual &&
667         test_cmp expected actual
668 '
669
670 cat > expected << EOF
671 reset refs/heads/master
672 from :14
673
674 EOF
675
676 test_expect_success 'refs are updated even if no commits need to be exported' '
677         > tmp-marks &&
678         git fast-export --import-marks=tmp-marks \
679                 --export-marks=tmp-marks master > /dev/null &&
680         git fast-export --import-marks=tmp-marks \
681                 --export-marks=tmp-marks master > actual &&
682         test_cmp expected actual
683 '
684
685 test_expect_success 'use refspec' '
686         git fast-export --refspec refs/heads/master:refs/heads/foobar master >actual2 &&
687         grep "^commit " actual2 | sort | uniq >actual &&
688         echo "commit refs/heads/foobar" > expected &&
689         test_cmp expected actual
690 '
691
692 test_expect_success 'delete ref because entire history excluded' '
693         git branch to-delete &&
694         git fast-export to-delete ^to-delete >actual &&
695         cat >expected <<-EOF &&
696         reset refs/heads/to-delete
697         from $ZERO_OID
698
699         EOF
700         test_cmp expected actual
701 '
702
703 test_expect_success 'delete refspec' '
704         git fast-export --refspec :refs/heads/to-delete >actual &&
705         cat >expected <<-EOF &&
706         reset refs/heads/to-delete
707         from $ZERO_OID
708
709         EOF
710         test_cmp expected actual
711 '
712
713 test_expect_success 'when using -C, do not declare copy when source of copy is also modified' '
714         test_create_repo src &&
715         echo a_line >src/file.txt &&
716         git -C src add file.txt &&
717         git -C src commit -m 1st_commit &&
718
719         cp src/file.txt src/file2.txt &&
720         echo another_line >>src/file.txt &&
721         git -C src add file.txt file2.txt &&
722         git -C src commit -m 2nd_commit &&
723
724         test_create_repo dst &&
725         git -C src fast-export --all -C >actual &&
726         git -C dst fast-import <actual &&
727         git -C src show >expected &&
728         git -C dst show >actual &&
729         test_cmp expected actual
730 '
731
732 test_expect_success 'merge commit gets exported with --import-marks' '
733         test_create_repo merging &&
734         (
735                 cd merging &&
736                 test_commit initial &&
737                 git checkout -b topic &&
738                 test_commit on-topic &&
739                 git checkout master &&
740                 test_commit on-master &&
741                 test_tick &&
742                 git merge --no-ff -m Yeah topic &&
743
744                 echo ":1 $(git rev-parse HEAD^^)" >marks &&
745                 git fast-export --import-marks=marks master >out &&
746                 grep Yeah out
747         )
748 '
749
750 test_done