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.'
54 test_expect_success 'empty stream succeeds' '
55 git fast-import </dev/null
58 test_expect_success 'A: create pack from stdin' '
60 cat >input <<-INPUT_END &&
77 commit refs/heads/master
79 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
91 An annotated tag without a tagger
97 An annotated tag that annotates a blob.
101 git fast-import --export-marks=marks.out <input &&
102 git whatchanged master
105 test_expect_success 'A: verify pack' '
109 test_expect_success 'A: verify commit' '
110 cat >expect <<-EOF &&
111 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
112 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
116 git cat-file commit master | sed 1d >actual &&
117 test_cmp expect actual
120 test_expect_success 'A: verify tree' '
121 cat >expect <<-EOF &&
126 git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
127 test_cmp expect actual
130 test_expect_success 'A: verify file2' '
131 echo "$file2_data" >expect &&
132 git cat-file blob master:file2 >actual &&
133 test_cmp expect actual
136 test_expect_success 'A: verify file3' '
137 echo "$file3_data" >expect &&
138 git cat-file blob master:file3 >actual &&
139 test_cmp expect actual
142 test_expect_success 'A: verify file4' '
143 printf "$file4_data" >expect &&
144 git cat-file blob master:file4 >actual &&
145 test_cmp expect actual
148 test_expect_success 'A: verify tag/series-A' '
149 cat >expect <<-EOF &&
150 object $(git rev-parse refs/heads/master)
154 An annotated tag without a tagger
156 git cat-file tag tags/series-A >actual &&
157 test_cmp expect actual
160 test_expect_success 'A: verify tag/series-A-blob' '
161 cat >expect <<-EOF &&
162 object $(git rev-parse refs/heads/master:file3)
166 An annotated tag that annotates a blob.
168 git cat-file tag tags/series-A-blob >actual &&
169 test_cmp expect actual
172 test_expect_success 'A: verify marks output' '
173 cat >expect <<-EOF &&
174 :2 $(git rev-parse --verify master:file2)
175 :3 $(git rev-parse --verify master:file3)
176 :4 $(git rev-parse --verify master:file4)
177 :5 $(git rev-parse --verify master^0)
179 test_cmp expect marks.out
182 test_expect_success 'A: verify marks import' '
184 --import-marks=marks.out \
185 --export-marks=marks.new \
187 test_cmp expect marks.new
190 test_expect_success 'A: tag blob by sha1' '
192 new_blob=$(echo testing | git hash-object --stdin) &&
193 cat >input <<-INPUT_END &&
195 from $(git rev-parse refs/heads/master:file3)
206 commit refs/heads/new_blob
210 #pretend we got sha1 from fast-import
220 cat >expect <<-EOF &&
221 object $(git rev-parse refs/heads/master:file3)
233 git fast-import <input &&
234 git cat-file tag tags/series-A-blob-2 >actual &&
235 git cat-file tag tags/series-A-blob-3 >>actual &&
236 test_cmp expect actual
239 test_expect_success 'A: verify marks import does not crash' '
241 cat >input <<-INPUT_END &&
242 commit refs/heads/verify--import-marks
243 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
249 M 755 :2 copy-of-file2
253 git fast-import --import-marks=marks.out <input &&
254 git whatchanged verify--import-marks
257 test_expect_success 'A: verify pack' '
261 test_expect_success 'A: verify diff' '
262 cat >expect <<-EOF &&
263 :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
265 git diff-tree -M -r master verify--import-marks >actual &&
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 test_expect_success 'A: export marks with large values' '
273 mt=$(git hash-object --stdin < /dev/null) &&
278 cat >input.commit <<-EOF &&
279 commit refs/heads/verify--dump-marks
280 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
282 test the sparse array dumping routines with exponentially growing marks
287 while test "$i" -lt 27
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 &&
316 i=$((1 + $i)) || return 1
319 sort tree.exp > tree.exp_s &&
321 cat input.blob input.commit | git fast-import --export-marks=marks.large &&
322 git ls-tree refs/heads/verify--dump-marks >tree.out &&
323 test_cmp tree.exp_s tree.out &&
324 test_cmp marks.exp marks.large
331 test_expect_success 'B: fail on invalid blob sha1' '
333 cat >input <<-INPUT_END &&
334 commit refs/heads/branch
336 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
341 from refs/heads/master
342 M 755 0000000000000000000000000000000000000001 zero1
346 test_when_finished "rm -f .git/objects/pack_* .git/objects/index_*" &&
347 test_must_fail git fast-import <input
350 test_expect_success 'B: accept branch name "TEMP_TAG"' '
351 cat >input <<-INPUT_END &&
353 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
358 from refs/heads/master
362 test_when_finished "rm -f .git/TEMP_TAG
365 git fast-import <input &&
366 test -f .git/TEMP_TAG &&
367 test $(git rev-parse master) = $(git rev-parse TEMP_TAG^)
370 test_expect_success 'B: accept empty committer' '
371 cat >input <<-INPUT_END &&
372 commit refs/heads/empty-committer-1
373 committer <> $GIT_COMMITTER_DATE
379 test_when_finished "git update-ref -d refs/heads/empty-committer-1
382 git fast-import <input &&
388 test_expect_success 'B: accept and fixup committer with no name' '
389 cat >input <<-INPUT_END &&
390 commit refs/heads/empty-committer-2
391 committer <a@b.com> $GIT_COMMITTER_DATE
397 test_when_finished "git update-ref -d refs/heads/empty-committer-2
400 git fast-import <input &&
406 test_expect_success 'B: fail on invalid committer (1)' '
407 cat >input <<-INPUT_END &&
408 commit refs/heads/invalid-committer
409 committer Name email> $GIT_COMMITTER_DATE
415 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
416 test_must_fail git fast-import <input
419 test_expect_success 'B: fail on invalid committer (2)' '
420 cat >input <<-INPUT_END &&
421 commit refs/heads/invalid-committer
422 committer Name <e<mail> $GIT_COMMITTER_DATE
428 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
429 test_must_fail git fast-import <input
432 test_expect_success 'B: fail on invalid committer (3)' '
433 cat >input <<-INPUT_END &&
434 commit refs/heads/invalid-committer
435 committer Name <email>> $GIT_COMMITTER_DATE
441 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
442 test_must_fail git fast-import <input
445 test_expect_success 'B: fail on invalid committer (4)' '
446 cat >input <<-INPUT_END &&
447 commit refs/heads/invalid-committer
448 committer Name <email $GIT_COMMITTER_DATE
454 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
455 test_must_fail git fast-import <input
458 test_expect_success 'B: fail on invalid committer (5)' '
459 cat >input <<-INPUT_END &&
460 commit refs/heads/invalid-committer
461 committer Name<email> $GIT_COMMITTER_DATE
467 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
468 test_must_fail git fast-import <input
475 test_expect_success 'C: incremental import create pack from stdin' '
476 newf=$(echo hi newf | git hash-object -w --stdin) &&
477 oldf=$(git rev-parse --verify master:file2) &&
479 cat >input <<-INPUT_END &&
480 commit refs/heads/branch
481 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
486 from refs/heads/master
487 M 644 $oldf file2/oldf
488 M 755 $newf file2/newf
493 git fast-import <input &&
494 git whatchanged branch
497 test_expect_success 'C: verify pack' '
501 test_expect_success 'C: validate reuse existing blob' '
502 test $newf = $(git rev-parse --verify branch:file2/newf) &&
503 test $oldf = $(git rev-parse --verify branch:file2/oldf)
506 test_expect_success 'C: verify commit' '
507 cat >expect <<-EOF &&
508 parent $(git rev-parse --verify master^0)
509 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
510 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
515 git cat-file commit branch | sed 1d >actual &&
516 test_cmp expect actual
519 test_expect_success 'C: validate rename result' '
520 cat >expect <<-EOF &&
521 :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
522 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
523 :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
525 git diff-tree -M -r master branch >actual &&
526 compare_diff_raw expect actual
533 test_expect_success 'D: inline data in commit' '
535 cat >input <<-INPUT_END &&
536 commit refs/heads/branch
537 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
542 from refs/heads/branch^0
543 M 644 inline newdir/interesting
548 M 755 inline newdir/exec.sh
555 git fast-import <input &&
556 git whatchanged branch
559 test_expect_success 'D: verify pack' '
563 test_expect_success 'D: validate new files added' '
564 cat >expect <<-EOF &&
565 :000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A newdir/exec.sh
566 :000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
568 git diff-tree -M -r branch^ branch >actual &&
569 compare_diff_raw expect actual
572 test_expect_success 'D: verify file5' '
573 echo "$file5_data" >expect &&
574 git cat-file blob branch:newdir/interesting >actual &&
575 test_cmp expect actual
578 test_expect_success 'D: verify file6' '
579 echo "$file6_data" >expect &&
580 git cat-file blob branch:newdir/exec.sh >actual &&
581 test_cmp expect actual
588 test_expect_success 'E: rfc2822 date, --date-format=raw' '
589 cat >input <<-INPUT_END &&
590 commit refs/heads/branch
591 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
592 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
597 from refs/heads/branch^0
601 test_must_fail git fast-import --date-format=raw <input
603 test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '
604 git fast-import --date-format=rfc2822 <input
607 test_expect_success 'E: verify pack' '
611 test_expect_success 'E: verify commit' '
612 cat >expect <<-EOF &&
613 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
614 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
618 git cat-file commit branch | sed 1,2d >actual &&
619 test_cmp expect actual
626 test_expect_success 'F: non-fast-forward update skips' '
627 old_branch=$(git rev-parse --verify branch^0) &&
629 cat >input <<-INPUT_END &&
630 commit refs/heads/branch
631 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
633 losing things already?
636 from refs/heads/branch~1
638 reset refs/heads/other
639 from refs/heads/branch
643 test_must_fail git fast-import <input &&
644 # branch must remain unaffected
645 test $old_branch = $(git rev-parse --verify branch^0)
648 test_expect_success 'F: verify pack' '
652 test_expect_success 'F: verify other commit' '
653 cat >expect <<-EOF &&
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 git cat-file commit other >actual &&
662 test_cmp expect actual
669 test_expect_success 'G: non-fast-forward update forced' '
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 git fast-import --force <input
685 test_expect_success 'G: verify pack' '
689 test_expect_success 'G: branch changed, but logged' '
690 test $old_branch != $(git rev-parse --verify branch^0) &&
691 test $old_branch = $(git rev-parse --verify branch@{1})
698 test_expect_success 'H: deletall, add 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 git fast-import <input &&
724 test_expect_success 'H: verify pack' '
728 test_expect_success 'H: validate old files removed, new files added' '
729 cat >expect <<-EOF &&
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 compare_diff_raw expect actual
740 test_expect_success 'H: verify file' '
741 echo "$file5_data" >expect &&
742 git cat-file blob H:h/e/l/lo >actual &&
743 test_cmp expect actual
750 test_expect_success 'I: export-pack-edges' '
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 git fast-import --export-pack-edges=edges.list <input
764 test_expect_success 'I: verify edge list' '
765 cat >expect <<-EOF &&
766 .git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)
768 sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
769 test_cmp expect actual
776 test_expect_success 'J: reset existing branch creates empty commit' '
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 git fast-import <input
797 test_expect_success 'J: branch has 1 commit, empty tree' '
798 test 1 = $(git rev-list J | wc -l) &&
799 test 0 = $(git ls-tree J | wc -l)
802 test_expect_success 'J: tag must fail on empty branch' '
803 cat >input <<-INPUT_END &&
809 Tag branch that was reset.
812 test_must_fail git fast-import <input
819 test_expect_success 'K: reinit branch with from' '
820 cat >input <<-INPUT_END &&
822 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
827 from refs/heads/branch
830 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
835 from refs/heads/branch^1
838 git fast-import <input
840 test_expect_success 'K: verify K^1 = branch^1' '
841 test $(git rev-parse --verify branch^1) \
842 = $(git rev-parse --verify K^1)
849 test_expect_success 'L: verify internal tree sorting' '
850 cat >input <<-INPUT_END &&
864 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
874 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
884 cat >expect <<-EXPECT_END &&
885 :100644 100644 4268632... 55d3a52... M b.
886 :040000 040000 0ae5cac... 443c768... M b
887 :100644 100644 4268632... 55d3a52... M ba
890 git fast-import <input &&
891 git diff-tree --abbrev --raw L^ L >output &&
892 test_cmp expect output
895 test_expect_success 'L: nested tree copy does not corrupt deltas' '
896 cat >input <<-INPUT_END &&
904 committer C O Mitter <committer@example.com> 1112912473 -0700
913 committer C O Mitter <committer@example.com> 1112912473 -0700
922 cat >expect <<-\EOF &&
927 test_when_finished "git update-ref -d refs/heads/L2" &&
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)
939 test_expect_success 'M: rename file in same subdirectory' '
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
953 cat >expect <<-EOF &&
954 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
956 git fast-import <input &&
957 git diff-tree -M -r M1^ M1 >actual &&
958 compare_diff_raw expect actual
961 test_expect_success 'M: rename file to new subdirectory' '
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
974 cat >expect <<-EOF &&
975 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
977 git fast-import <input &&
978 git diff-tree -M -r M2^ M2 >actual &&
979 compare_diff_raw expect actual
982 test_expect_success 'M: rename subdirectory to new subdirectory' '
983 cat >input <<-INPUT_END &&
985 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
995 cat >expect <<-EOF &&
996 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
998 git fast-import <input &&
999 git diff-tree -M -r M3^ M3 >actual &&
1000 compare_diff_raw expect actual
1003 test_expect_success 'M: rename root to subdirectory' '
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
1016 cat >expect <<-EOF &&
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 git fast-import <input &&
1024 git diff-tree -M -r M4^ M4 >actual &&
1026 compare_diff_raw expect actual
1033 test_expect_success 'N: copy file in same subdirectory' '
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
1047 cat >expect <<-EOF &&
1048 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
1050 git fast-import <input &&
1051 git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
1052 compare_diff_raw expect actual
1055 test_expect_success 'N: copy then modify subdirectory' '
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
1079 cat >expect <<-EOF &&
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 git fast-import <input &&
1085 git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
1086 compare_diff_raw expect actual
1089 test_expect_success 'N: copy dirty subdirectory' '
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 git fast-import <input &&
1109 test $(git rev-parse N2^{tree}) = $(git rev-parse N3^{tree})
1112 test_expect_success 'N: copy directory by id' '
1113 cat >expect <<-\EOF &&
1114 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1115 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1117 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1118 cat >input <<-INPUT_END &&
1119 commit refs/heads/N4
1120 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1125 from refs/heads/branch^0
1126 M 040000 $subdir file3
1128 git fast-import <input &&
1129 git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
1130 compare_diff_raw expect actual
1133 test_expect_success PIPE 'N: read and copy directory' '
1134 cat >expect <<-\EOF &&
1135 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1136 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1138 git update-ref -d refs/heads/N4 &&
1144 commit refs/heads/N4
1145 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1147 copy by tree hash, part 2
1150 from refs/heads/branch^0
1153 read mode type tree filename &&
1154 echo "M 040000 $tree file3"
1156 git fast-import --cat-blob-fd=3 3>backflow &&
1157 git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
1158 compare_diff_raw expect actual
1161 test_expect_success PIPE 'N: empty directory reads as missing' '
1162 cat <<-\EOF >expect &&
1164 :000000 100644 OBJNAME OBJNAME A unrelated
1166 echo "missing src" >expect.response &&
1167 git update-ref -d refs/heads/read-empty &&
1173 commit refs/heads/read-empty
1174 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1176 read "empty" (missing) directory
1179 M 100644 inline src/greeting
1183 C src/greeting dst1/non-greeting
1184 C src/greeting unrelated
1185 # leave behind "empty" src directory
1190 printf "%s\n" "$line" >response &&
1196 git fast-import --cat-blob-fd=3 3>backflow &&
1197 test_cmp expect.response response &&
1198 git rev-list read-empty |
1199 git diff-tree -r --root --stdin |
1200 sed "s/$_x40/OBJNAME/g" >actual &&
1201 test_cmp expect actual
1204 test_expect_success 'N: copy root directory by tree hash' '
1205 cat >expect <<-\EOF &&
1206 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file3/newf
1207 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file3/oldf
1209 root=$(git rev-parse refs/heads/branch^0^{tree}) &&
1210 cat >input <<-INPUT_END &&
1211 commit refs/heads/N6
1212 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1214 copy root directory by tree hash
1217 from refs/heads/branch^0
1220 git fast-import <input &&
1221 git diff-tree -C --find-copies-harder -r N4 N6 >actual &&
1222 compare_diff_raw expect actual
1225 test_expect_success 'N: copy root by path' '
1226 cat >expect <<-\EOF &&
1227 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf oldroot/file2/newf
1228 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf oldroot/file2/oldf
1229 :100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 C100 file4 oldroot/file4
1230 :100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 C100 newdir/exec.sh oldroot/newdir/exec.sh
1231 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting oldroot/newdir/interesting
1233 cat >input <<-INPUT_END &&
1234 commit refs/heads/N-copy-root-path
1235 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1237 copy root directory by (empty) path
1240 from refs/heads/branch^0
1243 git fast-import <input &&
1244 git diff-tree -C --find-copies-harder -r branch N-copy-root-path >actual &&
1245 compare_diff_raw expect actual
1248 test_expect_success 'N: delete directory by copying' '
1249 cat >expect <<-\EOF &&
1251 :100644 000000 OBJID OBJID D foo/bar/qux
1253 :000000 100644 OBJID OBJID A foo/bar/baz
1254 :000000 100644 OBJID OBJID A foo/bar/qux
1256 empty_tree=$(git mktree </dev/null) &&
1257 cat >input <<-INPUT_END &&
1258 commit refs/heads/N-delete
1259 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1261 collect data to be deleted
1265 M 100644 inline foo/bar/baz
1269 C "foo/bar/baz" "foo/bar/qux"
1270 C "foo/bar/baz" "foo/bar/quux/1"
1271 C "foo/bar/baz" "foo/bar/quuux"
1272 M 040000 $empty_tree foo/bar/quux
1273 M 040000 $empty_tree foo/bar/quuux
1275 commit refs/heads/N-delete
1276 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1281 M 040000 $empty_tree foo/bar/qux
1283 git fast-import <input &&
1284 git rev-list N-delete |
1285 git diff-tree -r --stdin --root --always |
1286 sed -e "s/$_x40/OBJID/g" >actual &&
1287 test_cmp expect actual
1290 test_expect_success 'N: modify copied tree' '
1291 cat >expect <<-\EOF &&
1292 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
1293 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1294 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1296 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1297 cat >input <<-INPUT_END &&
1298 commit refs/heads/N5
1299 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1304 from refs/heads/branch^0
1305 M 040000 $subdir file3
1307 commit refs/heads/N5
1308 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1310 modify directory copy
1313 M 644 inline file3/file5
1318 git fast-import <input &&
1319 git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&
1320 compare_diff_raw expect actual
1323 test_expect_success 'N: reject foo/ syntax' '
1324 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1325 test_must_fail git fast-import <<-INPUT_END
1326 commit refs/heads/N5B
1327 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1329 copy with invalid syntax
1332 from refs/heads/branch^0
1333 M 040000 $subdir file3/
1337 test_expect_success 'N: reject foo/ syntax in copy source' '
1338 test_must_fail git fast-import <<-INPUT_END
1339 commit refs/heads/N5C
1340 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1342 copy with invalid syntax
1345 from refs/heads/branch^0
1350 test_expect_success 'N: reject foo/ syntax in rename source' '
1351 test_must_fail git fast-import <<-INPUT_END
1352 commit refs/heads/N5D
1353 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1355 rename with invalid syntax
1358 from refs/heads/branch^0
1363 test_expect_success 'N: reject foo/ syntax in ls argument' '
1364 test_must_fail git fast-import <<-INPUT_END
1365 commit refs/heads/N5E
1366 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1368 copy with invalid syntax
1371 from refs/heads/branch^0
1376 test_expect_success 'N: copy to root by id and modify' '
1377 echo "hello, world" >expect.foo &&
1378 echo hello >expect.bar &&
1379 git fast-import <<-SETUP_END &&
1380 commit refs/heads/N7
1381 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1387 M 644 inline foo/bar
1393 tree=$(git rev-parse --verify N7:) &&
1394 git fast-import <<-INPUT_END &&
1395 commit refs/heads/N8
1396 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1398 copy to root by id and modify
1402 M 644 inline foo/foo
1407 git show N8:foo/foo >actual.foo &&
1408 git show N8:foo/bar >actual.bar &&
1409 test_cmp expect.foo actual.foo &&
1410 test_cmp expect.bar actual.bar
1413 test_expect_success 'N: extract subtree' '
1414 branch=$(git rev-parse --verify refs/heads/branch^{tree}) &&
1415 cat >input <<-INPUT_END &&
1416 commit refs/heads/N9
1417 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1419 extract subtree branch:newdir
1425 git fast-import <input &&
1426 git diff --exit-code branch:newdir N9
1429 test_expect_success 'N: modify subtree, extract it, and modify again' '
1430 echo hello >expect.baz &&
1431 echo hello, world >expect.qux &&
1432 git fast-import <<-SETUP_END &&
1433 commit refs/heads/N10
1434 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1440 M 644 inline foo/bar/baz
1446 tree=$(git rev-parse --verify N10:) &&
1447 git fast-import <<-INPUT_END &&
1448 commit refs/heads/N11
1449 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1451 copy to root by id and modify
1455 M 100644 inline foo/bar/qux
1460 C "bar/qux" "bar/quux"
1462 git show N11:bar/baz >actual.baz &&
1463 git show N11:bar/qux >actual.qux &&
1464 git show N11:bar/quux >actual.quux &&
1465 test_cmp expect.baz actual.baz &&
1466 test_cmp expect.qux actual.qux &&
1467 test_cmp expect.qux actual.quux'
1473 test_expect_success 'O: comments are all skipped' '
1474 cat >input <<-INPUT_END &&
1476 commit refs/heads/O1
1477 # -- ignore all of this text
1478 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1479 # $GIT_COMMITTER_NAME has inserted here for his benefit.
1481 dirty directory copy
1484 # do not forget the import blank line!
1486 # yes, we started from our usual base of branch^0.
1488 from refs/heads/branch^0
1489 # and we need to reuse file2/file5 from N3 above.
1490 M 644 inline file2/file5
1491 # otherwise the tree will be different
1496 # do not forget to copy file2 to file3
1499 # or to delete file5 from file2.
1505 git fast-import <input &&
1506 test $(git rev-parse N3) = $(git rev-parse O1)
1509 test_expect_success 'O: blank lines not necessary after data commands' '
1510 cat >input <<-INPUT_END &&
1511 commit refs/heads/O2
1512 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1514 dirty directory copy
1516 from refs/heads/branch^0
1517 M 644 inline file2/file5
1526 git fast-import <input &&
1527 test $(git rev-parse N3) = $(git rev-parse O2)
1530 test_expect_success 'O: repack before next test' '
1534 test_expect_success 'O: blank lines not necessary after other commands' '
1535 cat >input <<-INPUT_END &&
1536 commit refs/heads/O3
1537 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1541 commit refs/heads/O3
1542 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1547 commit refs/heads/O3
1549 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1554 commit refs/heads/O3
1555 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1559 reset refs/tags/O3-2nd
1561 reset refs/tags/O3-3rd
1565 cat >expect <<-INPUT_END &&
1572 git fast-import <input &&
1573 test 8 = $(find .git/objects/pack -type f | wc -l) &&
1574 test $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&
1575 git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
1576 test_cmp expect actual
1579 test_expect_success 'O: progress outputs as requested by input' '
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 git fast-import <input >actual &&
1606 grep "progress " <input >expect &&
1607 test_cmp expect actual
1611 ### series P (gitlinks)
1614 test_expect_success 'P: superproject & submodule mix' '
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 git fast-import <input &&
1671 git checkout subuse1 &&
1677 git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
1680 git submodule init &&
1681 git submodule update
1684 test_expect_success 'P: verbatim SHA gitlinks' '
1685 SUBLAST=$(git rev-parse --verify sub) &&
1686 SUBPREV=$(git rev-parse --verify sub^) &&
1688 cat >input <<-INPUT_END &&
1697 commit refs/heads/subuse2
1699 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1702 from refs/heads/master
1703 M 100644 :1 .gitmodules
1704 M 160000 $SUBPREV sub
1706 commit refs/heads/subuse2
1708 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1712 M 160000 $SUBLAST sub
1716 git branch -D sub &&
1719 git fast-import <input &&
1720 test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
1723 test_expect_success 'P: fail on inline gitlink' '
1725 cat >input <<-INPUT_END &&
1726 commit refs/heads/subuse3
1728 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1733 from refs/heads/subuse2
1741 test_must_fail git fast-import <input
1744 test_expect_success 'P: fail on blob mark in gitlink' '
1746 cat >input <<-INPUT_END &&
1753 commit refs/heads/subuse3
1755 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1760 from refs/heads/subuse2
1765 test_must_fail git fast-import <input
1769 ### series Q (notes)
1772 test_expect_success 'Q: commit notes' '
1773 note1_data="The first note for the first commit" &&
1774 note2_data="The first note for the second commit" &&
1775 note3_data="The first note for the third commit" &&
1776 note1b_data="The second note for the first commit" &&
1777 note1c_data="The third note for the first commit" &&
1778 note2b_data="The second note for the second commit" &&
1781 cat >input <<-INPUT_END &&
1788 commit refs/heads/notes-test
1790 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1801 commit refs/heads/notes-test
1803 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1810 commit refs/heads/notes-test
1812 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1839 commit refs/notes/foobar
1841 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1853 commit refs/notes/foobar
1855 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1865 commit refs/notes/foobar2
1867 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1877 commit refs/notes/foobar
1879 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1892 git fast-import <input &&
1893 git whatchanged notes-test
1896 test_expect_success 'Q: verify pack' '
1900 test_expect_success 'Q: verify first commit' '
1901 commit1=$(git rev-parse notes-test~2) &&
1902 commit2=$(git rev-parse notes-test^) &&
1903 commit3=$(git rev-parse notes-test) &&
1905 cat >expect <<-EOF &&
1906 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1907 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1911 git cat-file commit notes-test~2 | sed 1d >actual &&
1912 test_cmp expect actual
1915 test_expect_success 'Q: verify second commit' '
1916 cat >expect <<-EOF &&
1918 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1919 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1923 git cat-file commit notes-test^ | sed 1d >actual &&
1924 test_cmp expect actual
1927 test_expect_success 'Q: verify third commit' '
1928 cat >expect <<-EOF &&
1930 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1931 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1935 git cat-file commit notes-test | sed 1d >actual &&
1936 test_cmp expect actual
1939 test_expect_success 'Q: verify first notes commit' '
1940 cat >expect <<-EOF &&
1941 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1942 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1946 git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&
1947 test_cmp expect actual
1950 test_expect_success 'Q: verify first notes tree' '
1951 cat >expect.unsorted <<-EOF &&
1952 100644 blob $commit1
1953 100644 blob $commit2
1954 100644 blob $commit3
1956 cat expect.unsorted | sort >expect &&
1957 git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1958 test_cmp expect actual
1961 test_expect_success 'Q: verify first note for first commit' '
1962 echo "$note1_data" >expect &&
1963 git cat-file blob refs/notes/foobar~2:$commit1 >actual &&
1964 test_cmp expect actual
1967 test_expect_success 'Q: verify first note for second commit' '
1968 echo "$note2_data" >expect &&
1969 git cat-file blob refs/notes/foobar~2:$commit2 >actual &&
1970 test_cmp expect actual
1973 test_expect_success 'Q: verify first note for third commit' '
1974 echo "$note3_data" >expect &&
1975 git cat-file blob refs/notes/foobar~2:$commit3 >actual &&
1976 test_cmp expect actual
1979 test_expect_success 'Q: verify second notes commit' '
1980 cat >expect <<-EOF &&
1981 parent $(git rev-parse --verify refs/notes/foobar~2)
1982 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1983 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1987 git cat-file commit refs/notes/foobar^ | sed 1d >actual &&
1988 test_cmp expect actual
1991 test_expect_success 'Q: verify second notes tree' '
1992 cat >expect.unsorted <<-EOF &&
1993 100644 blob $commit1
1994 100644 blob $commit2
1995 100644 blob $commit3
1997 cat expect.unsorted | sort >expect &&
1998 git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1999 test_cmp expect actual
2002 test_expect_success 'Q: verify second note for first commit' '
2003 echo "$note1b_data" >expect &&
2004 git cat-file blob refs/notes/foobar^:$commit1 >actual &&
2005 test_cmp expect actual
2008 test_expect_success 'Q: verify first note for second commit' '
2009 echo "$note2_data" >expect &&
2010 git cat-file blob refs/notes/foobar^:$commit2 >actual &&
2011 test_cmp expect actual
2014 test_expect_success 'Q: verify first note for third commit' '
2015 echo "$note3_data" >expect &&
2016 git cat-file blob refs/notes/foobar^:$commit3 >actual &&
2017 test_cmp expect actual
2020 test_expect_success 'Q: verify third notes commit' '
2021 cat >expect <<-EOF &&
2022 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2023 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2027 git cat-file commit refs/notes/foobar2 | sed 1d >actual &&
2028 test_cmp expect actual
2031 test_expect_success 'Q: verify third notes tree' '
2032 cat >expect.unsorted <<-EOF &&
2033 100644 blob $commit1
2035 cat expect.unsorted | sort >expect &&
2036 git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2037 test_cmp expect actual
2040 test_expect_success 'Q: verify third note for first commit' '
2041 echo "$note1c_data" >expect &&
2042 git cat-file blob refs/notes/foobar2:$commit1 >actual &&
2043 test_cmp expect actual
2046 test_expect_success 'Q: verify fourth notes commit' '
2047 cat >expect <<-EOF &&
2048 parent $(git rev-parse --verify refs/notes/foobar^)
2049 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2050 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2054 git cat-file commit refs/notes/foobar | sed 1d >actual &&
2055 test_cmp expect actual
2058 test_expect_success 'Q: verify fourth notes tree' '
2059 cat >expect.unsorted <<-EOF &&
2060 100644 blob $commit2
2062 cat expect.unsorted | sort >expect &&
2063 git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2064 test_cmp expect actual
2067 test_expect_success 'Q: verify second note for second commit' '
2068 echo "$note2b_data" >expect &&
2069 git cat-file blob refs/notes/foobar:$commit2 >actual &&
2070 test_cmp expect actual
2073 test_expect_success 'Q: deny note on empty branch' '
2074 cat >input <<-EOF &&
2077 commit refs/heads/note-Q0
2078 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2080 Note for an empty branch.
2083 N inline refs/heads/Q0
2088 test_must_fail git fast-import <input
2091 ### series R (feature and option)
2094 test_expect_success 'R: abort on unsupported feature' '
2095 cat >input <<-EOF &&
2096 feature no-such-feature-exists
2099 test_must_fail git fast-import <input
2102 test_expect_success 'R: supported feature is accepted' '
2103 cat >input <<-EOF &&
2104 feature date-format=now
2107 git fast-import <input
2110 test_expect_success 'R: abort on receiving feature after data command' '
2111 cat >input <<-EOF &&
2115 feature date-format=now
2118 test_must_fail git fast-import <input
2121 test_expect_success 'R: only one import-marks feature allowed per stream' '
2122 cat >input <<-EOF &&
2123 feature import-marks=git.marks
2124 feature import-marks=git2.marks
2127 test_must_fail git fast-import <input
2130 test_expect_success 'R: export-marks feature results in a marks file being created' '
2131 cat >input <<-EOF &&
2132 feature export-marks=git.marks
2140 cat input | git fast-import &&
2144 test_expect_success 'R: export-marks options can be overridden by commandline options' '
2145 cat input | git fast-import --export-marks=other.marks &&
2149 test_expect_success 'R: catch typo in marks file name' '
2150 test_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&
2151 echo "feature import-marks=nonexistent.marks" |
2152 test_must_fail git fast-import
2155 test_expect_success 'R: import and output marks can be the same file' '
2157 blob=$(echo hi | git hash-object --stdin) &&
2158 cat >expect <<-EOF &&
2162 git fast-import --export-marks=io.marks <<-\EOF &&
2169 git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF &&
2176 test_cmp expect io.marks
2179 test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '
2181 test_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF
2190 test_expect_success 'R: --import-marks-if-exists' '
2192 blob=$(echo hi | git hash-object --stdin) &&
2193 echo ":1 $blob" >expect &&
2194 git fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\EOF &&
2201 test_cmp expect io.marks
2204 test_expect_success 'R: feature import-marks-if-exists' '
2208 git fast-import --export-marks=io.marks <<-\EOF &&
2209 feature import-marks-if-exists=not_io.marks
2211 test_cmp expect io.marks &&
2213 blob=$(echo hi | git hash-object --stdin) &&
2215 echo ":1 $blob" >io.marks &&
2216 echo ":1 $blob" >expect &&
2217 echo ":2 $blob" >>expect &&
2219 git fast-import --export-marks=io.marks <<-\EOF &&
2220 feature import-marks-if-exists=io.marks
2227 test_cmp expect io.marks &&
2229 echo ":3 $blob" >>expect &&
2231 git fast-import --import-marks=io.marks \
2232 --export-marks=io.marks <<-\EOF &&
2233 feature import-marks-if-exists=not_io.marks
2240 test_cmp expect io.marks &&
2244 git fast-import --import-marks-if-exists=not_io.marks \
2245 --export-marks=io.marks <<-\EOF &&
2246 feature import-marks-if-exists=io.marks
2248 test_cmp expect io.marks
2251 test_expect_success 'R: import to output marks works without any content' '
2252 cat >input <<-EOF &&
2253 feature import-marks=marks.out
2254 feature export-marks=marks.new
2257 cat input | git fast-import &&
2258 test_cmp marks.out marks.new
2261 test_expect_success 'R: import marks prefers commandline marks file over the stream' '
2262 cat >input <<-EOF &&
2263 feature import-marks=nonexistent.marks
2264 feature export-marks=marks.new
2267 cat input | git fast-import --import-marks=marks.out &&
2268 test_cmp marks.out marks.new
2272 test_expect_success 'R: multiple --import-marks= should be honoured' '
2273 cat >input <<-EOF &&
2274 feature import-marks=nonexistent.marks
2275 feature export-marks=combined.marks
2278 head -n2 marks.out > one.marks &&
2279 tail -n +3 marks.out > two.marks &&
2280 git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
2281 test_cmp marks.out combined.marks
2284 test_expect_success 'R: feature relative-marks should be honoured' '
2285 cat >input <<-EOF &&
2286 feature relative-marks
2287 feature import-marks=relative.in
2288 feature export-marks=relative.out
2291 mkdir -p .git/info/fast-import/ &&
2292 cp marks.new .git/info/fast-import/relative.in &&
2293 git fast-import <input &&
2294 test_cmp marks.new .git/info/fast-import/relative.out
2297 test_expect_success 'R: feature no-relative-marks should be honoured' '
2298 cat >input <<-EOF &&
2299 feature relative-marks
2300 feature import-marks=relative.in
2301 feature no-relative-marks
2302 feature export-marks=non-relative.out
2305 git fast-import <input &&
2306 test_cmp marks.new non-relative.out
2309 test_expect_success 'R: feature ls supported' '
2314 test_expect_success 'R: feature cat-blob supported' '
2315 echo "feature cat-blob" |
2319 test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '
2320 test_must_fail git fast-import --cat-blob-fd=-1 </dev/null
2323 test_expect_success !MINGW 'R: print old blob' '
2324 blob=$(echo "yes it can" | git hash-object -w --stdin) &&
2325 cat >expect <<-EOF &&
2330 echo "cat-blob $blob" |
2331 git fast-import --cat-blob-fd=6 6>actual &&
2332 test_cmp expect actual
2335 test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '
2336 echo hello >greeting &&
2337 blob=$(git hash-object -w greeting) &&
2338 cat >expect <<-EOF &&
2343 git fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&
2346 test_cmp expect actual.3 &&
2347 test_must_be_empty actual.1 &&
2348 git fast-import 3>actual.3 >actual.1 <<-EOF &&
2349 option cat-blob-fd=3
2352 test_must_be_empty actual.3 &&
2353 test_cmp expect actual.1
2356 test_expect_success !MINGW 'R: print mark for new blob' '
2357 echo "effluentish" | git hash-object --stdin >expect &&
2358 git fast-import --cat-blob-fd=6 6>actual <<-\EOF &&
2366 test_cmp expect actual
2369 test_expect_success !MINGW 'R: print new blob' '
2370 blob=$(echo "yep yep yep" | git hash-object --stdin) &&
2371 cat >expect <<-EOF &&
2376 git fast-import --cat-blob-fd=6 6>actual <<-\EOF &&
2384 test_cmp expect actual
2387 test_expect_success !MINGW 'R: print new blob by sha1' '
2388 blob=$(echo "a new blob named by sha1" | git hash-object --stdin) &&
2389 cat >expect <<-EOF &&
2391 a new blob named by sha1
2394 git fast-import --cat-blob-fd=6 6>actual <<-EOF &&
2397 a new blob named by sha1
2401 test_cmp expect actual
2404 test_expect_success 'setup: big file' '
2406 echo "the quick brown fox jumps over the lazy dog" >big &&
2409 cat big big big big >bigger &&
2410 cat bigger bigger bigger bigger >big ||
2416 test_expect_success 'R: print two blobs to stdout' '
2417 blob1=$(git hash-object big) &&
2418 blob1_len=$(wc -c <big) &&
2419 blob2=$(echo hello | git hash-object --stdin) &&
2421 echo ${blob1} blob $blob1_len &&
2431 cat <<-\END_PART1 &&
2448 git fast-import >actual &&
2449 test_cmp expect actual
2452 test_expect_success PIPE 'R: copy using cat-file' '
2453 expect_id=$(git hash-object big) &&
2454 expect_len=$(wc -c <big) &&
2455 echo $expect_id blob $expect_len >expect.response &&
2458 cat >frontend <<-\FRONTEND_END &&
2464 export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&
2477 read blob_id type size <&3 &&
2478 echo "$blob_id $type $size" >response &&
2479 head_c $size >blob <&3 &&
2483 commit refs/heads/copied
2484 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2486 copy big file as file3
2494 git fast-import --cat-blob-fd=3 3>blobs &&
2495 git show copied:file3 >actual &&
2496 test_cmp expect.response response &&
2500 test_expect_success PIPE 'R: print blob mid-commit' '
2502 echo "A blob from _before_ the commit." >expect &&
2511 A blob from _before_ the commit.
2513 commit refs/heads/temporary
2514 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2521 read blob_id type size <&3 &&
2522 head_c $size >actual <&3 &&
2527 git fast-import --cat-blob-fd=3 3>blobs &&
2528 test_cmp expect actual
2531 test_expect_success PIPE 'R: print staged blob within commit' '
2533 echo "A blob from _within_ the commit." >expect &&
2539 commit refs/heads/within
2540 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2546 A blob from _within_ the commit.
2551 echo "A blob from _within_ the commit." |
2552 git hash-object --stdin
2554 echo "cat-blob $to_get" &&
2556 read blob_id type size <&3 &&
2557 head_c $size >actual <&3 &&
2562 git fast-import --cat-blob-fd=3 3>blobs &&
2563 test_cmp expect actual
2566 test_expect_success 'R: quiet option results in no stats being output' '
2567 cat >input <<-EOF &&
2575 cat input | git fast-import 2> output &&
2576 test_must_be_empty output
2579 test_expect_success 'R: feature done means terminating "done" is mandatory' '
2580 echo feature done | test_must_fail git fast-import &&
2581 test_must_fail git fast-import --done </dev/null
2584 test_expect_success 'R: terminating "done" with trailing gibberish is ok' '
2585 git fast-import <<-\EOF &&
2590 git fast-import <<-\EOF
2592 more trailing gibberish
2596 test_expect_success 'R: terminating "done" within commit' '
2597 cat >expect <<-\EOF &&
2599 :000000 100644 OBJID OBJID A hello.c
2600 :000000 100644 OBJID OBJID A hello2.c
2602 git fast-import <<-EOF &&
2603 commit refs/heads/done-ends
2604 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2606 Commit terminated by "done" command
2608 M 100644 inline hello.c
2615 git rev-list done-ends |
2616 git diff-tree -r --stdin --root --always |
2617 sed -e "s/$_x40/OBJID/g" >actual &&
2618 test_cmp expect actual
2621 test_expect_success 'R: die on unknown option' '
2622 cat >input <<-EOF &&
2623 option git non-existing-option
2626 test_must_fail git fast-import <input
2629 test_expect_success 'R: unknown commandline options are rejected' '\
2630 test_must_fail git fast-import --non-existing-option < /dev/null
2633 test_expect_success 'R: die on invalid option argument' '
2634 echo "option git active-branches=-5" |
2635 test_must_fail git fast-import &&
2636 echo "option git depth=" |
2637 test_must_fail git fast-import &&
2638 test_must_fail git fast-import --depth="5 elephants" </dev/null
2641 test_expect_success 'R: ignore non-git options' '
2642 cat >input <<-EOF &&
2643 option non-existing-vcs non-existing-option
2646 git fast-import <input
2650 ## R: very large blobs
2652 test_expect_success 'R: blob bigger than threshold' '
2653 blobsize=$((2*1024*1024 + 53)) &&
2654 test-genrandom bar $blobsize >expect &&
2655 cat >input <<-INPUT_END &&
2656 commit refs/heads/big-file
2657 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2665 cat expect >>input &&
2666 cat >>input <<-INPUT_END &&
2670 cat expect >>input &&
2673 test_create_repo R &&
2674 git --git-dir=R/.git fast-import --big-file-threshold=1 <input
2677 test_expect_success 'R: verify created pack' '
2680 verify_packs -v > ../verify
2684 test_expect_success 'R: verify written objects' '
2685 git --git-dir=R/.git cat-file blob big-file:big1 >actual &&
2686 test_cmp_bin expect actual &&
2687 a=$(git --git-dir=R/.git rev-parse big-file:big1) &&
2688 b=$(git --git-dir=R/.git rev-parse big-file:big2) &&
2692 test_expect_success 'R: blob appears only once' '
2693 n=$(grep $a verify | wc -l) &&
2701 # Make sure missing spaces and EOLs after mark references
2710 # commit marks: 301, 302, 303, 304
2711 # blob marks: 403, 404, resp.
2714 # The error message when a space is missing not at the
2715 # end of the line is:
2717 # Missing space after ..
2719 # or when extra characters come after the mark at the end
2724 # or when the dataref is neither "inline " or a known SHA1,
2726 # Invalid dataref ..
2728 test_expect_success 'S: initialize for S tests' '
2731 cat >input <<-INPUT_END &&
2734 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2738 M 100644 inline hello.c
2745 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2750 M 100644 inline hello.c
2768 git fast-import --export-marks=marks <input
2772 # filemodify, three datarefs
2774 test_expect_success 'S: filemodify with garbage after mark must fail' '
2775 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2777 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2781 M 100644 :403x hello.c
2784 test_i18ngrep "space after mark" err
2787 # inline is misspelled; fast-import thinks it is some unknown dataref
2788 test_expect_success 'S: filemodify with garbage after inline must fail' '
2789 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2791 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2795 M 100644 inlineX hello.c
2801 test_i18ngrep "nvalid dataref" err
2804 test_expect_success 'S: filemodify with garbage after sha1 must fail' '
2805 sha1=$(grep :403 marks | cut -d\ -f2) &&
2806 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2808 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2812 M 100644 ${sha1}x hello.c
2815 test_i18ngrep "space after SHA1" err
2819 # notemodify, three ways to say dataref
2821 test_expect_success 'S: notemodify with garabge after mark dataref must fail' '
2822 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2824 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2826 commit S note dataref markref
2831 test_i18ngrep "space after mark" err
2834 test_expect_success 'S: notemodify with garbage after inline dataref must fail' '
2835 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2837 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2839 commit S note dataref inline
2847 test_i18ngrep "nvalid dataref" err
2850 test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '
2851 sha1=$(grep :202 marks | cut -d\ -f2) &&
2852 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2854 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2856 commit S note dataref sha1
2861 test_i18ngrep "space after SHA1" err
2865 # notemodify, mark in commit-ish
2867 test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' '
2868 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2869 commit refs/heads/Snotes
2870 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2872 commit S note commit-ish
2877 test_i18ngrep "after mark" err
2883 test_expect_success 'S: from with garbage after mark must fail' '
2885 git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&
2886 commit refs/heads/S2
2888 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2893 M 100644 :403 hello.c
2897 # go create the commit, need it for merge test
2898 git fast-import --import-marks=marks --export-marks=marks <<-EOF &&
2899 commit refs/heads/S2
2901 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2906 M 100644 :403 hello.c
2909 # now evaluate the error
2911 test_i18ngrep "after mark" err
2918 test_expect_success 'S: merge with garbage after mark must fail' '
2919 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2922 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2928 M 100644 :403 hello.c
2931 test_i18ngrep "after mark" err
2937 test_expect_success 'S: tag with garbage after mark must fail' '
2938 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2941 tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2947 test_i18ngrep "after mark" err
2953 test_expect_success 'S: cat-blob with garbage after mark must fail' '
2954 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2958 test_i18ngrep "after mark" err
2964 test_expect_success 'S: ls with garbage after mark must fail' '
2965 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2969 test_i18ngrep "space after mark" err
2972 test_expect_success 'S: ls with garbage after sha1 must fail' '
2973 sha1=$(grep :302 marks | cut -d\ -f2) &&
2974 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2978 test_i18ngrep "space after tree-ish" err
2984 # Setup is carried over from series S.
2986 test_expect_success 'T: ls root tree' '
2987 sed -e "s/Z\$//" >expect <<-EOF &&
2988 040000 tree $(git rev-parse S^{tree}) Z
2990 sha1=$(git rev-parse --verify S) &&
2991 git fast-import --import-marks=marks <<-EOF >actual &&
2994 test_cmp expect actual
2997 test_expect_success 'T: delete branch' '
2998 git branch to-delete &&
2999 git fast-import <<-EOF &&
3000 reset refs/heads/to-delete
3001 from 0000000000000000000000000000000000000000
3003 test_must_fail git rev-parse --verify refs/heads/to-delete
3006 test_expect_success 'T: empty reset doesnt delete branch' '
3007 git branch not-to-delete &&
3008 git fast-import <<-EOF &&
3009 reset refs/heads/not-to-delete
3012 git rev-parse --verify refs/heads/not-to-delete
3016 ### series U (filedelete)
3019 test_expect_success 'U: initialize for U tests' '
3020 cat >input <<-INPUT_END &&
3022 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3026 M 100644 inline hello.c
3030 M 100644 inline good/night.txt
3034 M 100644 inline good/bye.txt
3041 git fast-import <input
3044 test_expect_success 'U: filedelete file succeeds' '
3045 cat >input <<-INPUT_END &&
3047 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3049 delete good/night.txt
3056 git fast-import <input
3059 test_expect_success 'U: validate file delete result' '
3060 cat >expect <<-EOF &&
3061 :100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D good/night.txt
3064 git diff-tree -M -r U^1 U >actual &&
3066 compare_diff_raw expect actual
3069 test_expect_success 'U: filedelete directory succeeds' '
3070 cat >input <<-INPUT_END &&
3072 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3081 git fast-import <input
3084 test_expect_success 'U: validate directory delete result' '
3085 cat >expect <<-EOF &&
3086 :100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D good/bye.txt
3089 git diff-tree -M -r U^1 U >actual &&
3091 compare_diff_raw expect actual
3094 test_expect_success 'U: filedelete root succeeds' '
3095 cat >input <<-INPUT_END &&
3097 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3106 git fast-import <input
3109 test_expect_success 'U: validate root delete result' '
3110 cat >expect <<-EOF &&
3111 :100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D hello.c
3114 git diff-tree -M -r U^1 U >actual &&
3116 compare_diff_raw expect actual