3 # Copyright (c) 2007 Shawn Pearce
6 test_description
='test git fast-import utility'
8 .
"$TEST_DIRECTORY"/diff-lib.sh
;# test-lib chdir's into trash
10 # Print $1 bytes from stdin to stdout.
12 # This could be written as "head -c $1", but IRIX "head" does not
13 # support the -c option.
19 my $nread = sysread(STDIN, $s, $len);
20 die "cannot read: $!" unless defined($nread);
28 for p
in .git
/objects
/pack
/*.pack
30 git verify-pack
"$@" "$p" ||
return
44 file5_data
='an inline file.
45 we should see it later.'
58 test_expect_success
'empty stream succeeds' '
59 git fast-import </dev/null
62 cat >input
<<INPUT_END
79 commit refs/heads/master
81 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
93 An annotated tag without a tagger
99 An annotated tag that annotates a blob.
103 test_expect_success \
104 'A: create pack from stdin' \
105 'git fast-import --export-marks=marks.out <input &&
106 git whatchanged master'
108 test_expect_success
'A: verify pack' '
113 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
114 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
118 test_expect_success \
120 'git cat-file commit master | sed 1d >actual &&
121 test_cmp expect actual'
128 test_expect_success \
130 'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
131 test_cmp expect actual'
133 echo "$file2_data" >expect
134 test_expect_success \
136 'git cat-file blob master:file2 >actual && test_cmp expect actual'
138 echo "$file3_data" >expect
139 test_expect_success \
141 'git cat-file blob master:file3 >actual && test_cmp expect actual'
143 printf "$file4_data" >expect
144 test_expect_success \
146 'git cat-file blob master:file4 >actual && test_cmp expect actual'
149 object $(git rev-parse refs/heads/master)
153 An annotated tag without a tagger
155 test_expect_success
'A: verify tag/series-A' '
156 git cat-file tag tags/series-A >actual &&
157 test_cmp expect actual
161 object $(git rev-parse refs/heads/master:file3)
165 An annotated tag that annotates a blob.
167 test_expect_success
'A: verify tag/series-A-blob' '
168 git cat-file tag tags/series-A-blob >actual &&
169 test_cmp expect actual
173 :2 `git rev-parse --verify master:file2`
174 :3 `git rev-parse --verify master:file3`
175 :4 `git rev-parse --verify master:file4`
176 :5 `git rev-parse --verify master^0`
178 test_expect_success \
179 'A: verify marks output' \
180 'test_cmp expect marks.out'
182 test_expect_success \
183 'A: verify marks import' \
185 --import-marks=marks.out \
186 --export-marks=marks.new \
188 test_cmp expect marks.new'
191 new_blob
=$
(echo testing | git hash-object
--stdin)
192 cat >input
<<INPUT_END
194 from $(git rev-parse refs/heads/master:file3)
205 commit refs/heads/new_blob
209 #pretend we got sha1 from fast-import
220 object $(git rev-parse refs/heads/master:file3)
232 test_expect_success \
233 'A: tag blob by sha1' \
234 'git fast-import <input &&
235 git cat-file tag tags/series-A-blob-2 >actual &&
236 git cat-file tag tags/series-A-blob-3 >>actual &&
237 test_cmp expect actual'
240 cat >input
<<INPUT_END
241 commit refs/heads/verify--import-marks
242 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
248 M 755 :2 copy-of-file2
251 test_expect_success \
252 'A: verify marks import does not crash' \
253 'git fast-import --import-marks=marks.out <input &&
254 git whatchanged verify--import-marks'
256 test_expect_success
'A: verify pack' '
261 :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
263 git diff-tree
-M -r master verify--import-marks
>actual
264 test_expect_success \
266 'compare_diff_raw expect actual &&
267 test `git rev-parse --verify master:file2` \
268 = `git rev-parse --verify verify--import-marks:copy-of-file2`'
271 mt
=$
(git hash-object
--stdin < /dev
/null
)
276 cat >input.commit
<<EOF
277 commit refs/heads/verify--dump-marks
278 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
280 test the sparse array dumping routines with exponentially growing marks
288 while test "$i" -lt 27; do
289 cat >>input.blob
<<EOF
300 echo "M 100644 :$l l$i" >>input.commit
301 echo "M 100644 :$m m$i" >>input.commit
302 echo "M 100644 :$n n$i" >>input.commit
304 echo ":$l $mt" >>marks.exp
305 echo ":$m $mt" >>marks.exp
306 echo ":$n $mt" >>marks.exp
308 printf "100644 blob $mt\tl$i\n" >>tree.exp
309 printf "100644 blob $mt\tm$i\n" >>tree.exp
310 printf "100644 blob $mt\tn$i\n" >>tree.exp
319 sort tree.exp
> tree.exp_s
321 test_expect_success
'A: export marks with large values' '
322 cat input.blob input.commit | git fast-import --export-marks=marks.large &&
323 git ls-tree refs/heads/verify--dump-marks >tree.out &&
324 test_cmp tree.exp_s tree.out &&
325 test_cmp marks.exp marks.large'
332 cat >input
<<INPUT_END
333 commit refs/heads/branch
335 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
340 from refs/heads/master
341 M 755 0000000000000000000000000000000000000001 zero1
344 test_expect_success
'B: fail on invalid blob sha1' '
345 test_must_fail git fast-import <input
347 rm -f .git
/objects
/pack_
* .git
/objects
/index_
*
349 cat >input
<<INPUT_END
351 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
356 from refs/heads/master
359 test_expect_success \
360 'B: accept branch name "TEMP_TAG"' \
361 'git fast-import <input &&
362 test -f .git/TEMP_TAG &&
363 test `git rev-parse master` = `git rev-parse TEMP_TAG^`'
366 git gc
2>/dev
/null
>/dev
/null
367 git prune
2>/dev
/null
>/dev
/null
369 cat >input
<<INPUT_END
370 commit refs/heads/empty-committer-1
371 committer <> $GIT_COMMITTER_DATE
376 test_expect_success
'B: accept empty committer' '
377 git fast-import <input &&
382 git update-ref
-d refs
/heads
/empty-committer-1 || true
384 git gc
2>/dev
/null
>/dev
/null
385 git prune
2>/dev
/null
>/dev
/null
387 cat >input
<<INPUT_END
388 commit refs/heads/empty-committer-2
389 committer <a@b.com> $GIT_COMMITTER_DATE
394 test_expect_success
'B: accept and fixup committer with no name' '
395 git fast-import <input &&
400 git update-ref
-d refs
/heads
/empty-committer-2 || true
402 git gc
2>/dev
/null
>/dev
/null
403 git prune
2>/dev
/null
>/dev
/null
405 cat >input
<<INPUT_END
406 commit refs/heads/invalid-committer
407 committer Name email> $GIT_COMMITTER_DATE
412 test_expect_success
'B: fail on invalid committer (1)' '
413 test_must_fail git fast-import <input
415 git update-ref
-d refs
/heads
/invalid-committer || true
417 cat >input
<<INPUT_END
418 commit refs/heads/invalid-committer
419 committer Name <e<mail> $GIT_COMMITTER_DATE
424 test_expect_success
'B: fail on invalid committer (2)' '
425 test_must_fail git fast-import <input
427 git update-ref
-d refs
/heads
/invalid-committer || true
429 cat >input
<<INPUT_END
430 commit refs/heads/invalid-committer
431 committer Name <email>> $GIT_COMMITTER_DATE
436 test_expect_success
'B: fail on invalid committer (3)' '
437 test_must_fail git fast-import <input
439 git update-ref
-d refs
/heads
/invalid-committer || true
441 cat >input
<<INPUT_END
442 commit refs/heads/invalid-committer
443 committer Name <email $GIT_COMMITTER_DATE
448 test_expect_success
'B: fail on invalid committer (4)' '
449 test_must_fail git fast-import <input
451 git update-ref
-d refs
/heads
/invalid-committer || true
453 cat >input
<<INPUT_END
454 commit refs/heads/invalid-committer
455 committer Name<email> $GIT_COMMITTER_DATE
460 test_expect_success
'B: fail on invalid committer (5)' '
461 test_must_fail git fast-import <input
463 git update-ref
-d refs
/heads
/invalid-committer || true
469 newf
=`echo hi newf | git hash-object -w --stdin`
470 oldf
=`git rev-parse --verify master:file2`
472 cat >input
<<INPUT_END
473 commit refs/heads/branch
474 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
479 from refs/heads/master
480 M 644 $oldf file2/oldf
481 M 755 $newf file2/newf
485 test_expect_success \
486 'C: incremental import create pack from stdin' \
487 'git fast-import <input &&
488 git whatchanged branch'
490 test_expect_success
'C: verify pack' '
494 test_expect_success \
495 'C: validate reuse existing blob' \
496 'test $newf = `git rev-parse --verify branch:file2/newf` &&
497 test $oldf = `git rev-parse --verify branch:file2/oldf`'
500 parent `git rev-parse --verify master^0`
501 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
502 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
506 test_expect_success \
508 'git cat-file commit branch | sed 1d >actual &&
509 test_cmp expect actual'
512 :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
513 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
514 :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
516 git diff-tree
-M -r master branch
>actual
517 test_expect_success \
518 'C: validate rename result' \
519 'compare_diff_raw expect actual'
526 cat >input
<<INPUT_END
527 commit refs/heads/branch
528 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
533 from refs/heads/branch^0
534 M 644 inline newdir/interesting
539 M 755 inline newdir/exec.sh
545 test_expect_success \
546 'D: inline data in commit' \
547 'git fast-import <input &&
548 git whatchanged branch'
550 test_expect_success
'D: verify pack' '
555 :000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A newdir/exec.sh
556 :000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
558 git diff-tree
-M -r branch^ branch
>actual
559 test_expect_success \
560 'D: validate new files added' \
561 'compare_diff_raw expect actual'
563 echo "$file5_data" >expect
564 test_expect_success \
566 'git cat-file blob branch:newdir/interesting >actual &&
567 test_cmp expect actual'
569 echo "$file6_data" >expect
570 test_expect_success \
572 'git cat-file blob branch:newdir/exec.sh >actual &&
573 test_cmp expect actual'
579 cat >input
<<INPUT_END
580 commit refs/heads/branch
581 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
582 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
587 from refs/heads/branch^0
590 test_expect_success
'E: rfc2822 date, --date-format=raw' '
591 test_must_fail git fast-import --date-format=raw <input
593 test_expect_success \
594 'E: rfc2822 date, --date-format=rfc2822' \
595 'git fast-import --date-format=rfc2822 <input'
597 test_expect_success
'E: verify pack' '
602 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
603 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
607 test_expect_success \
609 'git cat-file commit branch | sed 1,2d >actual &&
610 test_cmp expect actual'
616 old_branch
=`git rev-parse --verify branch^0`
618 cat >input
<<INPUT_END
619 commit refs/heads/branch
620 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
622 losing things already?
625 from refs/heads/branch~1
627 reset refs/heads/other
628 from refs/heads/branch
631 test_expect_success \
632 'F: non-fast-forward update skips' \
633 'if git fast-import <input
635 echo BAD gfi did not fail
638 if test $old_branch = `git rev-parse --verify branch^0`
640 : branch unaffected and failure returned
643 echo BAD gfi changed branch $old_branch
649 test_expect_success
'F: verify pack' '
654 tree `git rev-parse branch~1^{tree}`
655 parent `git rev-parse branch~1`
656 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
657 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
659 losing things already?
661 test_expect_success \
662 'F: verify other commit' \
663 'git cat-file commit other >actual &&
664 test_cmp expect actual'
670 old_branch
=`git rev-parse --verify branch^0`
672 cat >input
<<INPUT_END
673 commit refs/heads/branch
674 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
676 losing things already?
679 from refs/heads/branch~1
682 test_expect_success \
683 'G: non-fast-forward update forced' \
684 'git fast-import --force <input'
686 test_expect_success
'G: verify pack' '
690 test_expect_success \
691 'G: branch changed, but logged' \
692 'test $old_branch != `git rev-parse --verify branch^0` &&
693 test $old_branch = `git rev-parse --verify branch@{1}`'
700 cat >input
<<INPUT_END
702 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
707 from refs/heads/branch^0
708 M 644 inline i-will-die
710 this file will never exist.
714 M 644 inline h/e/l/lo
720 test_expect_success \
721 'H: deletall, add 1' \
722 'git fast-import <input &&
725 test_expect_success
'H: verify pack' '
730 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
731 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
732 :100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
733 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
734 :100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
736 git diff-tree
-M -r H^ H
>actual
737 test_expect_success \
738 'H: validate old files removed, new files added' \
739 'compare_diff_raw expect actual'
741 echo "$file5_data" >expect
742 test_expect_success \
744 'git cat-file blob H:h/e/l/lo >actual &&
745 test_cmp expect actual'
751 cat >input
<<INPUT_END
752 commit refs/heads/export-boundary
753 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
755 we have a border. its only 40 characters wide.
758 from refs/heads/branch
761 test_expect_success \
762 'I: export-pack-edges' \
763 'git fast-import --export-pack-edges=edges.list <input'
766 .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
768 test_expect_success \
769 'I: verify edge list' \
770 'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
771 test_cmp expect actual'
777 cat >input
<<INPUT_END
779 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
784 from refs/heads/branch
789 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
795 test_expect_success \
796 'J: reset existing branch creates empty commit' \
797 'git fast-import <input'
798 test_expect_success \
799 'J: branch has 1 commit, empty tree' \
800 'test 1 = `git rev-list J | wc -l` &&
801 test 0 = `git ls-tree J | wc -l`'
803 cat >input
<<INPUT_END
809 Tag branch that was reset.
812 test_expect_success \
813 'J: tag must fail on empty branch' \
814 'test_must_fail git fast-import <input'
819 cat >input
<<INPUT_END
821 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
826 from refs/heads/branch
829 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
834 from refs/heads/branch^1
837 test_expect_success \
838 'K: reinit branch with from' \
839 'git fast-import <input'
840 test_expect_success \
841 'K: verify K^1 = branch^1' \
842 'test `git rev-parse --verify branch^1` \
843 = `git rev-parse --verify K^1`'
849 cat >input
<<INPUT_END
863 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
873 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
883 cat >expect
<<EXPECT_END
884 :100644 100644 4268632... 55d3a52... M b.
885 :040000 040000 0ae5cac... 443c768... M b
886 :100644 100644 4268632... 55d3a52... M ba
889 test_expect_success \
890 'L: verify internal tree sorting' \
891 'git fast-import <input &&
892 git diff-tree --abbrev --raw L^ L >output &&
893 test_cmp expect output'
895 cat >input
<<INPUT_END
903 committer C O Mitter <committer@example.com> 1112912473 -0700
912 committer C O Mitter <committer@example.com> 1112912473 -0700
926 test_expect_success \
927 'L: nested tree copy does not corrupt deltas' \
928 'git fast-import <input &&
929 git ls-tree L2 g/b/ >tmp &&
930 cat tmp | cut -f 2 >actual &&
931 test_cmp expect actual &&
932 git fsck `git rev-parse L2`'
934 git update-ref
-d refs
/heads
/L2
941 cat >input
<<INPUT_END
943 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
948 from refs/heads/branch^0
949 R file2/newf file2/n.e.w.f
954 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
956 test_expect_success \
957 'M: rename file in same subdirectory' \
958 'git fast-import <input &&
959 git diff-tree -M -r M1^ M1 >actual &&
960 compare_diff_raw expect actual'
962 cat >input
<<INPUT_END
964 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
969 from refs/heads/branch^0
970 R file2/newf i/am/new/to/you
975 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
977 test_expect_success \
978 'M: rename file to new subdirectory' \
979 'git fast-import <input &&
980 git diff-tree -M -r M2^ M2 >actual &&
981 compare_diff_raw expect actual'
983 cat >input
<<INPUT_END
985 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
996 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
998 test_expect_success \
999 'M: rename subdirectory to new subdirectory' \
1000 'git fast-import <input &&
1001 git diff-tree -M -r M3^ M3 >actual &&
1002 compare_diff_raw expect actual'
1004 cat >input
<<INPUT_END
1005 commit refs/heads/M4
1006 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1011 from refs/heads/M2^0
1017 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2/oldf sub/file2/oldf
1018 :100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 R100 file4 sub/file4
1019 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you sub/i/am/new/to/you
1020 :100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 R100 newdir/exec.sh sub/newdir/exec.sh
1021 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting sub/newdir/interesting
1023 test_expect_success \
1024 'M: rename root to subdirectory' \
1025 'git fast-import <input &&
1026 git diff-tree -M -r M4^ M4 >actual &&
1028 compare_diff_raw expect actual'
1035 cat >input
<<INPUT_END
1036 commit refs/heads/N1
1037 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1042 from refs/heads/branch^0
1043 C file2/newf file2/n.e.w.f
1048 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
1050 test_expect_success \
1051 'N: copy file in same subdirectory' \
1052 'git fast-import <input &&
1053 git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
1054 compare_diff_raw expect actual'
1056 cat >input
<<INPUT_END
1057 commit refs/heads/N2
1058 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1060 clean directory copy
1063 from refs/heads/branch^0
1066 commit refs/heads/N2
1067 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1069 modify directory copy
1072 M 644 inline file3/file5
1080 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
1081 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1082 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1084 test_expect_success \
1085 'N: copy then modify subdirectory' \
1086 'git fast-import <input &&
1087 git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
1088 compare_diff_raw expect actual'
1090 cat >input
<<INPUT_END
1091 commit refs/heads/N3
1092 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1094 dirty directory copy
1097 from refs/heads/branch^0
1098 M 644 inline file2/file5
1108 test_expect_success \
1109 'N: copy dirty subdirectory' \
1110 'git fast-import <input &&
1111 test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`'
1113 test_expect_success \
1114 'N: copy directory by id' \
1115 'cat >expect <<-\EOF &&
1116 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1117 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1119 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1120 cat >input <<-INPUT_END &&
1121 commit refs/heads/N4
1122 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1127 from refs/heads/branch^0
1128 M 040000 $subdir file3
1130 git fast-import <input &&
1131 git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
1132 compare_diff_raw expect actual'
1134 test_expect_success PIPE
'N: read and copy directory' '
1135 cat >expect <<-\EOF &&
1136 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1137 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1139 git update-ref -d refs/heads/N4 &&
1145 commit refs/heads/N4
1146 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1148 copy by tree hash, part 2
1151 from refs/heads/branch^0
1154 read mode type tree filename &&
1155 echo "M 040000 $tree file3"
1157 git fast-import --cat-blob-fd=3 3>backflow &&
1158 git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
1159 compare_diff_raw expect actual
1162 test_expect_success PIPE
'N: empty directory reads as missing' '
1163 cat <<-\EOF >expect &&
1165 :000000 100644 OBJNAME OBJNAME A unrelated
1167 echo "missing src" >expect.response &&
1168 git update-ref -d refs/heads/read-empty &&
1174 commit refs/heads/read-empty
1175 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1177 read "empty" (missing) directory
1180 M 100644 inline src/greeting
1184 C src/greeting dst1/non-greeting
1185 C src/greeting unrelated
1186 # leave behind "empty" src directory
1191 printf "%s\n" "$line" >response &&
1197 git fast-import --cat-blob-fd=3 3>backflow &&
1198 test_cmp expect.response response &&
1199 git rev-list read-empty |
1200 git diff-tree -r --root --stdin |
1201 sed "s/$_x40/OBJNAME/g" >actual &&
1202 test_cmp expect actual
1205 test_expect_success \
1206 'N: copy root directory by tree hash' \
1207 'cat >expect <<-\EOF &&
1208 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file3/newf
1209 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file3/oldf
1211 root=$(git rev-parse refs/heads/branch^0^{tree}) &&
1212 cat >input <<-INPUT_END &&
1213 commit refs/heads/N6
1214 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1216 copy root directory by tree hash
1219 from refs/heads/branch^0
1222 git fast-import <input &&
1223 git diff-tree -C --find-copies-harder -r N4 N6 >actual &&
1224 compare_diff_raw expect actual'
1226 test_expect_success \
1227 'N: copy root by path' \
1228 'cat >expect <<-\EOF &&
1229 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf oldroot/file2/newf
1230 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf oldroot/file2/oldf
1231 :100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 C100 file4 oldroot/file4
1232 :100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 C100 newdir/exec.sh oldroot/newdir/exec.sh
1233 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting oldroot/newdir/interesting
1235 cat >input <<-INPUT_END &&
1236 commit refs/heads/N-copy-root-path
1237 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1239 copy root directory by (empty) path
1242 from refs/heads/branch^0
1245 git fast-import <input &&
1246 git diff-tree -C --find-copies-harder -r branch N-copy-root-path >actual &&
1247 compare_diff_raw expect actual'
1249 test_expect_success \
1250 'N: delete directory by copying' \
1251 'cat >expect <<-\EOF &&
1253 :100644 000000 OBJID OBJID D foo/bar/qux
1255 :000000 100644 OBJID OBJID A foo/bar/baz
1256 :000000 100644 OBJID OBJID A foo/bar/qux
1258 empty_tree=$(git mktree </dev/null) &&
1259 cat >input <<-INPUT_END &&
1260 commit refs/heads/N-delete
1261 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1263 collect data to be deleted
1267 M 100644 inline foo/bar/baz
1271 C "foo/bar/baz" "foo/bar/qux"
1272 C "foo/bar/baz" "foo/bar/quux/1"
1273 C "foo/bar/baz" "foo/bar/quuux"
1274 M 040000 $empty_tree foo/bar/quux
1275 M 040000 $empty_tree foo/bar/quuux
1277 commit refs/heads/N-delete
1278 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1283 M 040000 $empty_tree foo/bar/qux
1285 git fast-import <input &&
1286 git rev-list N-delete |
1287 git diff-tree -r --stdin --root --always |
1288 sed -e "s/$_x40/OBJID/g" >actual &&
1289 test_cmp expect actual'
1291 test_expect_success \
1292 'N: modify copied tree' \
1293 'cat >expect <<-\EOF &&
1294 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
1295 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1296 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1298 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1299 cat >input <<-INPUT_END &&
1300 commit refs/heads/N5
1301 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1306 from refs/heads/branch^0
1307 M 040000 $subdir file3
1309 commit refs/heads/N5
1310 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1312 modify directory copy
1315 M 644 inline file3/file5
1320 git fast-import <input &&
1321 git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&
1322 compare_diff_raw expect actual'
1324 test_expect_success \
1325 'N: reject foo/ syntax' \
1326 'subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1327 test_must_fail git fast-import <<-INPUT_END
1328 commit refs/heads/N5B
1329 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1331 copy with invalid syntax
1334 from refs/heads/branch^0
1335 M 040000 $subdir file3/
1338 test_expect_success \
1339 'N: reject foo/ syntax in copy source' \
1340 'test_must_fail git fast-import <<-INPUT_END
1341 commit refs/heads/N5C
1342 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1344 copy with invalid syntax
1347 from refs/heads/branch^0
1351 test_expect_success \
1352 'N: reject foo/ syntax in rename source' \
1353 'test_must_fail git fast-import <<-INPUT_END
1354 commit refs/heads/N5D
1355 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1357 rename with invalid syntax
1360 from refs/heads/branch^0
1364 test_expect_success \
1365 'N: reject foo/ syntax in ls argument' \
1366 'test_must_fail git fast-import <<-INPUT_END
1367 commit refs/heads/N5E
1368 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1370 copy with invalid syntax
1373 from refs/heads/branch^0
1377 test_expect_success \
1378 'N: copy to root by id and modify' \
1379 'echo "hello, world" >expect.foo &&
1380 echo hello >expect.bar &&
1381 git fast-import <<-SETUP_END &&
1382 commit refs/heads/N7
1383 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1389 M 644 inline foo/bar
1395 tree=$(git rev-parse --verify N7:) &&
1396 git fast-import <<-INPUT_END &&
1397 commit refs/heads/N8
1398 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1400 copy to root by id and modify
1404 M 644 inline foo/foo
1409 git show N8:foo/foo >actual.foo &&
1410 git show N8:foo/bar >actual.bar &&
1411 test_cmp expect.foo actual.foo &&
1412 test_cmp expect.bar actual.bar'
1414 test_expect_success \
1415 'N: extract subtree' \
1416 'branch=$(git rev-parse --verify refs/heads/branch^{tree}) &&
1417 cat >input <<-INPUT_END &&
1418 commit refs/heads/N9
1419 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1421 extract subtree branch:newdir
1427 git fast-import <input &&
1428 git diff --exit-code branch:newdir N9'
1430 test_expect_success \
1431 'N: modify subtree, extract it, and modify again' \
1432 'echo hello >expect.baz &&
1433 echo hello, world >expect.qux &&
1434 git fast-import <<-SETUP_END &&
1435 commit refs/heads/N10
1436 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1442 M 644 inline foo/bar/baz
1448 tree=$(git rev-parse --verify N10:) &&
1449 git fast-import <<-INPUT_END &&
1450 commit refs/heads/N11
1451 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1453 copy to root by id and modify
1457 M 100644 inline foo/bar/qux
1462 C "bar/qux" "bar/quux"
1464 git show N11:bar/baz >actual.baz &&
1465 git show N11:bar/qux >actual.qux &&
1466 git show N11:bar/quux >actual.quux &&
1467 test_cmp expect.baz actual.baz &&
1468 test_cmp expect.qux actual.qux &&
1469 test_cmp expect.qux actual.quux'
1475 cat >input
<<INPUT_END
1477 commit refs/heads/O1
1478 # -- ignore all of this text
1479 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1480 # $GIT_COMMITTER_NAME has inserted here for his benefit.
1482 dirty directory copy
1485 # don't forget the import blank line!
1487 # yes, we started from our usual base of branch^0.
1489 from refs/heads/branch^0
1490 # and we need to reuse file2/file5 from N3 above.
1491 M 644 inline file2/file5
1492 # otherwise the tree will be different
1497 # don't forget to copy file2 to file3
1500 # or to delete file5 from file2.
1506 test_expect_success \
1507 'O: comments are all skipped' \
1508 'git fast-import <input &&
1509 test `git rev-parse N3` = `git rev-parse O1`'
1511 cat >input
<<INPUT_END
1512 commit refs/heads/O2
1513 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1515 dirty directory copy
1517 from refs/heads/branch^0
1518 M 644 inline file2/file5
1527 test_expect_success \
1528 'O: blank lines not necessary after data commands' \
1529 'git fast-import <input &&
1530 test `git rev-parse N3` = `git rev-parse O2`'
1532 test_expect_success \
1533 'O: repack before next test' \
1536 cat >input
<<INPUT_END
1537 commit refs/heads/O3
1538 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1542 commit refs/heads/O3
1543 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1548 commit refs/heads/O3
1550 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1555 commit refs/heads/O3
1556 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1560 reset refs/tags/O3-2nd
1562 reset refs/tags/O3-3rd
1566 cat >expect
<<INPUT_END
1572 test_expect_success \
1573 'O: blank lines not necessary after other commands' \
1574 'git fast-import <input &&
1575 test 8 = `find .git/objects/pack -type f | wc -l` &&
1576 test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
1577 git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
1578 test_cmp expect actual'
1580 cat >input
<<INPUT_END
1581 commit refs/heads/O4
1582 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1586 commit refs/heads/O4
1587 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1591 progress Two commits down, 2 to go!
1592 commit refs/heads/O4
1593 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1597 progress Three commits down, 1 to go!
1598 commit refs/heads/O4
1599 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1605 test_expect_success \
1606 'O: progress outputs as requested by input' \
1607 'git fast-import <input >actual &&
1608 grep "progress " <input >expect &&
1609 test_cmp expect actual'
1612 ### series P (gitlinks)
1615 cat >input
<<INPUT_END
1621 reset refs/heads/sub
1622 commit refs/heads/sub
1624 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1637 commit refs/heads/subuse1
1639 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1642 from refs/heads/master
1643 M 100644 :3 .gitmodules
1652 commit refs/heads/sub
1654 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1660 commit refs/heads/subuse1
1662 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1670 test_expect_success \
1671 'P: superproject & submodule mix' \
1672 'git fast-import <input &&
1673 git checkout subuse1 &&
1674 rm -rf sub && mkdir sub && (cd sub &&
1676 git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
1677 git checkout master) &&
1678 git submodule init &&
1679 git submodule update'
1681 SUBLAST
=$
(git rev-parse
--verify sub
)
1682 SUBPREV
=$
(git rev-parse
--verify sub^
)
1684 cat >input
<<INPUT_END
1693 commit refs/heads/subuse2
1695 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1698 from refs/heads/master
1699 M 100644 :1 .gitmodules
1700 M 160000 $SUBPREV sub
1702 commit refs/heads/subuse2
1704 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1708 M 160000 $SUBLAST sub
1712 test_expect_success \
1713 'P: verbatim SHA gitlinks' \
1714 'git branch -D sub &&
1715 git gc && git prune &&
1716 git fast-import <input &&
1717 test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)'
1720 cat >input
<<INPUT_END
1721 commit refs/heads/subuse3
1723 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1728 from refs/heads/subuse2
1736 test_expect_success
'P: fail on inline gitlink' '
1737 test_must_fail git fast-import <input'
1740 cat >input
<<INPUT_END
1747 commit refs/heads/subuse3
1749 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1754 from refs/heads/subuse2
1759 test_expect_success
'P: fail on blob mark in gitlink' '
1760 test_must_fail git fast-import <input'
1763 ### series Q (notes)
1766 note1_data
="The first note for the first commit"
1767 note2_data
="The first note for the second commit"
1768 note3_data
="The first note for the third commit"
1769 note1b_data
="The second note for the first commit"
1770 note1c_data
="The third note for the first commit"
1771 note2b_data
="The second note for the second commit"
1774 cat >input
<<INPUT_END
1781 commit refs/heads/notes-test
1783 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1794 commit refs/heads/notes-test
1796 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1803 commit refs/heads/notes-test
1805 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1832 commit refs/notes/foobar
1834 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1846 commit refs/notes/foobar
1848 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1858 commit refs/notes/foobar2
1860 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1870 commit refs/notes/foobar
1872 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1885 test_expect_success \
1887 'git fast-import <input &&
1888 git whatchanged notes-test'
1890 test_expect_success
'Q: verify pack' '
1894 commit1
=$
(git rev-parse notes-test~
2)
1895 commit2
=$
(git rev-parse notes-test^
)
1896 commit3
=$
(git rev-parse notes-test
)
1899 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1900 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1904 test_expect_success \
1905 'Q: verify first commit' \
1906 'git cat-file commit notes-test~2 | sed 1d >actual &&
1907 test_cmp expect actual'
1911 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1912 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1916 test_expect_success \
1917 'Q: verify second commit' \
1918 'git cat-file commit notes-test^ | sed 1d >actual &&
1919 test_cmp expect actual'
1923 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1924 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1928 test_expect_success \
1929 'Q: verify third commit' \
1930 'git cat-file commit notes-test | sed 1d >actual &&
1931 test_cmp expect actual'
1934 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1935 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1939 test_expect_success \
1940 'Q: verify first notes commit' \
1941 'git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&
1942 test_cmp expect actual'
1944 cat >expect.unsorted
<<EOF
1945 100644 blob $commit1
1946 100644 blob $commit2
1947 100644 blob $commit3
1949 cat expect.unsorted |
sort >expect
1950 test_expect_success \
1951 'Q: verify first notes tree' \
1952 'git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1953 test_cmp expect actual'
1955 echo "$note1_data" >expect
1956 test_expect_success \
1957 'Q: verify first note for first commit' \
1958 'git cat-file blob refs/notes/foobar~2:$commit1 >actual && test_cmp expect actual'
1960 echo "$note2_data" >expect
1961 test_expect_success \
1962 'Q: verify first note for second commit' \
1963 'git cat-file blob refs/notes/foobar~2:$commit2 >actual && test_cmp expect actual'
1965 echo "$note3_data" >expect
1966 test_expect_success \
1967 'Q: verify first note for third commit' \
1968 'git cat-file blob refs/notes/foobar~2:$commit3 >actual && test_cmp expect actual'
1971 parent `git rev-parse --verify refs/notes/foobar~2`
1972 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1973 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1977 test_expect_success \
1978 'Q: verify second notes commit' \
1979 'git cat-file commit refs/notes/foobar^ | sed 1d >actual &&
1980 test_cmp expect actual'
1982 cat >expect.unsorted
<<EOF
1983 100644 blob $commit1
1984 100644 blob $commit2
1985 100644 blob $commit3
1987 cat expect.unsorted |
sort >expect
1988 test_expect_success \
1989 'Q: verify second notes tree' \
1990 'git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1991 test_cmp expect actual'
1993 echo "$note1b_data" >expect
1994 test_expect_success \
1995 'Q: verify second note for first commit' \
1996 'git cat-file blob refs/notes/foobar^:$commit1 >actual && test_cmp expect actual'
1998 echo "$note2_data" >expect
1999 test_expect_success \
2000 'Q: verify first note for second commit' \
2001 'git cat-file blob refs/notes/foobar^:$commit2 >actual && test_cmp expect actual'
2003 echo "$note3_data" >expect
2004 test_expect_success \
2005 'Q: verify first note for third commit' \
2006 'git cat-file blob refs/notes/foobar^:$commit3 >actual && test_cmp expect actual'
2009 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2010 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2014 test_expect_success \
2015 'Q: verify third notes commit' \
2016 'git cat-file commit refs/notes/foobar2 | sed 1d >actual &&
2017 test_cmp expect actual'
2019 cat >expect.unsorted
<<EOF
2020 100644 blob $commit1
2022 cat expect.unsorted |
sort >expect
2023 test_expect_success \
2024 'Q: verify third notes tree' \
2025 'git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2026 test_cmp expect actual'
2028 echo "$note1c_data" >expect
2029 test_expect_success \
2030 'Q: verify third note for first commit' \
2031 'git cat-file blob refs/notes/foobar2:$commit1 >actual && test_cmp expect actual'
2034 parent `git rev-parse --verify refs/notes/foobar^`
2035 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2036 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2040 test_expect_success \
2041 'Q: verify fourth notes commit' \
2042 'git cat-file commit refs/notes/foobar | sed 1d >actual &&
2043 test_cmp expect actual'
2045 cat >expect.unsorted
<<EOF
2046 100644 blob $commit2
2048 cat expect.unsorted |
sort >expect
2049 test_expect_success \
2050 'Q: verify fourth notes tree' \
2051 'git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2052 test_cmp expect actual'
2054 echo "$note2b_data" >expect
2055 test_expect_success \
2056 'Q: verify second note for second commit' \
2057 'git cat-file blob refs/notes/foobar:$commit2 >actual && test_cmp expect actual'
2062 commit refs/heads/note-Q0
2063 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2065 Note for an empty branch.
2068 N inline refs/heads/Q0
2073 test_expect_success \
2074 'Q: deny note on empty branch' \
2075 'test_must_fail git fast-import <input'
2077 ### series R (feature and option)
2081 feature no-such-feature-exists
2084 test_expect_success
'R: abort on unsupported feature' '
2085 test_must_fail git fast-import <input
2089 feature date-format=now
2092 test_expect_success
'R: supported feature is accepted' '
2093 git fast-import <input
2100 feature date-format=now
2103 test_expect_success
'R: abort on receiving feature after data command' '
2104 test_must_fail git fast-import <input
2108 feature import-marks=git.marks
2109 feature import-marks=git2.marks
2112 test_expect_success
'R: only one import-marks feature allowed per stream' '
2113 test_must_fail git fast-import <input
2117 feature export-marks=git.marks
2125 test_expect_success \
2126 'R: export-marks feature results in a marks file being created' \
2127 'cat input | git fast-import &&
2130 test_expect_success \
2131 'R: export-marks options can be overridden by commandline options' \
2132 'cat input | git fast-import --export-marks=other.marks &&
2133 grep :1 other.marks'
2135 test_expect_success
'R: catch typo in marks file name' '
2136 test_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&
2137 echo "feature import-marks=nonexistent.marks" |
2138 test_must_fail git fast-import
2141 test_expect_success
'R: import and output marks can be the same file' '
2143 blob=$(echo hi | git hash-object --stdin) &&
2144 cat >expect <<-EOF &&
2148 git fast-import --export-marks=io.marks <<-\EOF &&
2155 git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF &&
2162 test_cmp expect io.marks
2165 test_expect_success
'R: --import-marks=foo --output-marks=foo to create foo fails' '
2167 test_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF
2176 test_expect_success
'R: --import-marks-if-exists' '
2178 blob=$(echo hi | git hash-object --stdin) &&
2179 echo ":1 $blob" >expect &&
2180 git fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\EOF &&
2187 test_cmp expect io.marks
2190 test_expect_success
'R: feature import-marks-if-exists' '
2194 git fast-import --export-marks=io.marks <<-\EOF &&
2195 feature import-marks-if-exists=not_io.marks
2197 test_cmp expect io.marks &&
2199 blob=$(echo hi | git hash-object --stdin) &&
2201 echo ":1 $blob" >io.marks &&
2202 echo ":1 $blob" >expect &&
2203 echo ":2 $blob" >>expect &&
2205 git fast-import --export-marks=io.marks <<-\EOF &&
2206 feature import-marks-if-exists=io.marks
2213 test_cmp expect io.marks &&
2215 echo ":3 $blob" >>expect &&
2217 git fast-import --import-marks=io.marks \
2218 --export-marks=io.marks <<-\EOF &&
2219 feature import-marks-if-exists=not_io.marks
2226 test_cmp expect io.marks &&
2230 git fast-import --import-marks-if-exists=not_io.marks \
2231 --export-marks=io.marks <<-\EOF &&
2232 feature import-marks-if-exists=io.marks
2234 test_cmp expect io.marks
2238 feature import-marks=marks.out
2239 feature export-marks=marks.new
2242 test_expect_success \
2243 'R: import to output marks works without any content' \
2244 'cat input | git fast-import &&
2245 test_cmp marks.out marks.new'
2248 feature import-marks=nonexistent.marks
2249 feature export-marks=marks.new
2252 test_expect_success \
2253 'R: import marks prefers commandline marks file over the stream' \
2254 'cat input | git fast-import --import-marks=marks.out &&
2255 test_cmp marks.out marks.new'
2259 feature import-marks=nonexistent.marks
2260 feature export-marks=combined.marks
2263 test_expect_success
'R: multiple --import-marks= should be honoured' '
2264 head -n2 marks.out > one.marks &&
2265 tail -n +3 marks.out > two.marks &&
2266 git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
2267 test_cmp marks.out combined.marks
2271 feature relative-marks
2272 feature import-marks=relative.in
2273 feature export-marks=relative.out
2276 test_expect_success
'R: feature relative-marks should be honoured' '
2277 mkdir -p .git/info/fast-import/ &&
2278 cp marks.new .git/info/fast-import/relative.in &&
2279 git fast-import <input &&
2280 test_cmp marks.new .git/info/fast-import/relative.out
2284 feature relative-marks
2285 feature import-marks=relative.in
2286 feature no-relative-marks
2287 feature export-marks=non-relative.out
2290 test_expect_success
'R: feature no-relative-marks should be honoured' '
2291 git fast-import <input &&
2292 test_cmp marks.new non-relative.out
2295 test_expect_success
'R: feature ls supported' '
2300 test_expect_success
'R: feature cat-blob supported' '
2301 echo "feature cat-blob" |
2305 test_expect_success
'R: cat-blob-fd must be a nonnegative integer' '
2306 test_must_fail git fast-import --cat-blob-fd=-1 </dev/null
2309 test_expect_success
!MINGW
'R: print old blob' '
2310 blob=$(echo "yes it can" | git hash-object -w --stdin) &&
2311 cat >expect <<-EOF &&
2316 echo "cat-blob $blob" |
2317 git fast-import --cat-blob-fd=6 6>actual &&
2318 test_cmp expect actual
2321 test_expect_success
!MINGW
'R: in-stream cat-blob-fd not respected' '
2322 echo hello >greeting &&
2323 blob=$(git hash-object -w greeting) &&
2324 cat >expect <<-EOF &&
2329 git fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&
2332 test_cmp expect actual.3 &&
2333 test_cmp empty actual.1 &&
2334 git fast-import 3>actual.3 >actual.1 <<-EOF &&
2335 option cat-blob-fd=3
2338 test_cmp empty actual.3 &&
2339 test_cmp expect actual.1
2342 test_expect_success
!MINGW
'R: print new blob' '
2343 blob=$(echo "yep yep yep" | git hash-object --stdin) &&
2344 cat >expect <<-EOF &&
2349 git fast-import --cat-blob-fd=6 6>actual <<-\EOF &&
2357 test_cmp expect actual
2360 test_expect_success
!MINGW
'R: print new blob by sha1' '
2361 blob=$(echo "a new blob named by sha1" | git hash-object --stdin) &&
2362 cat >expect <<-EOF &&
2364 a new blob named by sha1
2367 git fast-import --cat-blob-fd=6 6>actual <<-EOF &&
2370 a new blob named by sha1
2374 test_cmp expect actual
2377 test_expect_success
'setup: big file' '
2379 echo "the quick brown fox jumps over the lazy dog" >big &&
2382 cat big big big big >bigger &&
2383 cat bigger bigger bigger bigger >big ||
2389 test_expect_success
'R: print two blobs to stdout' '
2390 blob1=$(git hash-object big) &&
2391 blob1_len=$(wc -c <big) &&
2392 blob2=$(echo hello | git hash-object --stdin) &&
2394 echo ${blob1} blob $blob1_len &&
2404 cat <<-\END_PART1 &&
2421 git fast-import >actual &&
2422 test_cmp expect actual
2425 test_expect_success PIPE
'R: copy using cat-file' '
2426 expect_id=$(git hash-object big) &&
2427 expect_len=$(wc -c <big) &&
2428 echo $expect_id blob $expect_len >expect.response &&
2431 cat >frontend <<-\FRONTEND_END &&
2437 export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&
2450 read blob_id type size <&3 &&
2451 echo "$blob_id $type $size" >response &&
2452 head_c $size >blob <&3 &&
2456 commit refs/heads/copied
2457 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2459 copy big file as file3
2467 git fast-import --cat-blob-fd=3 3>blobs &&
2468 git show copied:file3 >actual &&
2469 test_cmp expect.response response &&
2473 test_expect_success PIPE
'R: print blob mid-commit' '
2475 echo "A blob from _before_ the commit." >expect &&
2484 A blob from _before_ the commit.
2486 commit refs/heads/temporary
2487 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2494 read blob_id type size <&3 &&
2495 head_c $size >actual <&3 &&
2500 git fast-import --cat-blob-fd=3 3>blobs &&
2501 test_cmp expect actual
2504 test_expect_success PIPE
'R: print staged blob within commit' '
2506 echo "A blob from _within_ the commit." >expect &&
2512 commit refs/heads/within
2513 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2519 A blob from _within_ the commit.
2524 echo "A blob from _within_ the commit." |
2525 git hash-object --stdin
2527 echo "cat-blob $to_get" &&
2529 read blob_id type size <&3 &&
2530 head_c $size >actual <&3 &&
2535 git fast-import --cat-blob-fd=3 3>blobs &&
2536 test_cmp expect actual
2547 test_expect_success
'R: quiet option results in no stats being output' '
2548 cat input | git fast-import 2> output &&
2549 test_cmp empty output
2552 test_expect_success
'R: feature done means terminating "done" is mandatory' '
2553 echo feature done | test_must_fail git fast-import &&
2554 test_must_fail git fast-import --done </dev/null
2557 test_expect_success
'R: terminating "done" with trailing gibberish is ok' '
2558 git fast-import <<-\EOF &&
2563 git fast-import <<-\EOF
2565 more trailing gibberish
2569 test_expect_success
'R: terminating "done" within commit' '
2570 cat >expect <<-\EOF &&
2572 :000000 100644 OBJID OBJID A hello.c
2573 :000000 100644 OBJID OBJID A hello2.c
2575 git fast-import <<-EOF &&
2576 commit refs/heads/done-ends
2577 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2579 Commit terminated by "done" command
2581 M 100644 inline hello.c
2588 git rev-list done-ends |
2589 git diff-tree -r --stdin --root --always |
2590 sed -e "s/$_x40/OBJID/g" >actual &&
2591 test_cmp expect actual
2595 option git non-existing-option
2598 test_expect_success
'R: die on unknown option' '
2599 test_must_fail git fast-import <input
2602 test_expect_success
'R: unknown commandline options are rejected' '\
2603 test_must_fail git fast-import --non-existing-option < /dev/null
2606 test_expect_success
'R: die on invalid option argument' '
2607 echo "option git active-branches=-5" |
2608 test_must_fail git fast-import &&
2609 echo "option git depth=" |
2610 test_must_fail git fast-import &&
2611 test_must_fail git fast-import --depth="5 elephants" </dev/null
2615 option non-existing-vcs non-existing-option
2618 test_expect_success
'R: ignore non-git options' '
2619 git fast-import <input
2623 ## R: very large blobs
2625 blobsize
=$
((2*1024*1024 + 53))
2626 test-genrandom bar
$blobsize >expect
2627 cat >input
<<INPUT_END
2628 commit refs/heads/big-file
2629 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2638 cat >>input
<<INPUT_END
2645 test_expect_success \
2646 'R: blob bigger than threshold' \
2647 'test_create_repo R &&
2648 git --git-dir=R/.git fast-import --big-file-threshold=1 <input'
2650 test_expect_success
'R: verify created pack' '
2653 verify_packs -v > ../verify
2657 test_expect_success \
2658 'R: verify written objects' \
2659 'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&
2660 test_cmp_bin expect actual &&
2661 a=$(git --git-dir=R/.git rev-parse big-file:big1) &&
2662 b=$(git --git-dir=R/.git rev-parse big-file:big2) &&
2664 test_expect_success \
2665 'R: blob appears only once' \
2666 'n=$(grep $a verify | wc -l) &&
2673 # Make sure missing spaces and EOLs after mark references
2682 # commit marks: 301, 302, 303, 304
2683 # blob marks: 403, 404, resp.
2686 # The error message when a space is missing not at the
2687 # end of the line is:
2689 # Missing space after ..
2691 # or when extra characters come after the mark at the end
2696 # or when the dataref is neither "inline " or a known SHA1,
2698 # Invalid dataref ..
2702 cat >input
<<INPUT_END
2705 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2709 M 100644 inline hello.c
2716 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2721 M 100644 inline hello.c
2739 test_expect_success
'S: initialize for S tests' '
2740 git fast-import --export-marks=marks <input
2744 # filemodify, three datarefs
2746 test_expect_success
'S: filemodify with garbage after mark must fail' '
2747 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2749 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2753 M 100644 :403x hello.c
2756 test_i18ngrep "space after mark" err
2759 # inline is misspelled; fast-import thinks it is some unknown dataref
2760 test_expect_success
'S: filemodify with garbage after inline must fail' '
2761 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2763 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2767 M 100644 inlineX hello.c
2773 test_i18ngrep "nvalid dataref" err
2776 test_expect_success
'S: filemodify with garbage after sha1 must fail' '
2777 sha1=$(grep :403 marks | cut -d\ -f2) &&
2778 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2780 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2784 M 100644 ${sha1}x hello.c
2787 test_i18ngrep "space after SHA1" err
2791 # notemodify, three ways to say dataref
2793 test_expect_success
'S: notemodify with garabge after mark dataref must fail' '
2794 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2796 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2798 commit S note dataref markref
2803 test_i18ngrep "space after mark" err
2806 test_expect_success
'S: notemodify with garbage after inline dataref must fail' '
2807 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2809 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2811 commit S note dataref inline
2819 test_i18ngrep "nvalid dataref" err
2822 test_expect_success
'S: notemodify with garbage after sha1 dataref must fail' '
2823 sha1=$(grep :202 marks | cut -d\ -f2) &&
2824 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2826 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2828 commit S note dataref sha1
2833 test_i18ngrep "space after SHA1" err
2837 # notemodify, mark in commit-ish
2839 test_expect_success
'S: notemodify with garbage after mark commit-ish must fail' '
2840 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2841 commit refs/heads/Snotes
2842 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2844 commit S note commit-ish
2849 test_i18ngrep "after mark" err
2855 test_expect_success
'S: from with garbage after mark must fail' '
2857 git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err
2858 commit refs/heads/S2
2860 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2865 M 100644 :403 hello.c
2869 echo returned $ret &&
2870 test $ret -ne 0 && # failed, but it created the commit
2872 # go create the commit, need it for merge test
2873 git fast-import --import-marks=marks --export-marks=marks <<-EOF &&
2874 commit refs/heads/S2
2876 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2881 M 100644 :403 hello.c
2884 # now evaluate the error
2886 test_i18ngrep "after mark" err
2893 test_expect_success
'S: merge with garbage after mark must fail' '
2894 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2897 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2903 M 100644 :403 hello.c
2906 test_i18ngrep "after mark" err
2912 test_expect_success
'S: tag with garbage after mark must fail' '
2913 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2916 tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2922 test_i18ngrep "after mark" err
2928 test_expect_success
'S: cat-blob with garbage after mark must fail' '
2929 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2933 test_i18ngrep "after mark" err
2939 test_expect_success
'S: ls with garbage after mark must fail' '
2940 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2944 test_i18ngrep "space after mark" err
2947 test_expect_success
'S: ls with garbage after sha1 must fail' '
2948 sha1=$(grep :302 marks | cut -d\ -f2) &&
2949 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2953 test_i18ngrep "space after tree-ish" err
2959 # Setup is carried over from series S.
2961 test_expect_success
'T: ls root tree' '
2962 sed -e "s/Z\$//" >expect <<-EOF &&
2963 040000 tree $(git rev-parse S^{tree}) Z
2965 sha1=$(git rev-parse --verify S) &&
2966 git fast-import --import-marks=marks <<-EOF >actual &&
2969 test_cmp expect actual
2972 test_expect_success
'T: delete branch' '
2973 git branch to-delete &&
2974 git fast-import <<-EOF &&
2975 reset refs/heads/to-delete
2976 from 0000000000000000000000000000000000000000
2978 test_must_fail git rev-parse --verify refs/heads/to-delete
2981 test_expect_success
'T: empty reset doesnt delete branch' '
2982 git branch not-to-delete &&
2983 git fast-import <<-EOF &&
2984 reset refs/heads/not-to-delete
2987 git rev-parse --verify refs/heads/not-to-delete
2991 ### series U (filedelete)
2994 cat >input
<<INPUT_END
2996 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3000 M 100644 inline hello.c
3004 M 100644 inline good/night.txt
3008 M 100644 inline good/bye.txt
3015 test_expect_success
'U: initialize for U tests' '
3016 git fast-import <input
3019 cat >input
<<INPUT_END
3021 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3023 delete good/night.txt
3030 test_expect_success
'U: filedelete file succeeds' '
3031 git fast-import <input
3035 :100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D good/night.txt
3038 git diff-tree
-M -r U^
1 U
>actual
3040 test_expect_success
'U: validate file delete result' '
3041 compare_diff_raw expect actual
3044 cat >input
<<INPUT_END
3046 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3055 test_expect_success
'U: filedelete directory succeeds' '
3056 git fast-import <input
3060 :100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D good/bye.txt
3063 git diff-tree
-M -r U^
1 U
>actual
3065 test_expect_success
'U: validate directory delete result' '
3066 compare_diff_raw expect actual
3069 cat >input
<<INPUT_END
3071 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3080 test_expect_success
'U: filedelete root succeeds' '
3081 git fast-import <input
3085 :100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D hello.c
3088 git diff-tree
-M -r U^
1 U
>actual
3090 test_expect_success
'U: validate root delete result' '
3091 compare_diff_raw expect actual