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
11 for p
in .git
/objects
/pack
/*.pack
13 git verify-pack
"$@" "$p" ||
return
27 file5_data
='an inline file.
28 we should see it later.'
37 test_expect_success
'empty stream succeeds' '
38 git fast-import </dev/null
41 test_expect_success
'truncated stream complains' '
42 echo "tag foo" | test_must_fail git fast-import
45 test_expect_success
'A: create pack from stdin' '
47 cat >input <<-INPUT_END &&
64 commit refs/heads/master
66 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
78 An annotated tag without a tagger
84 An annotated tag that annotates a blob.
88 git fast-import --export-marks=marks.out <input &&
89 git whatchanged master
92 test_expect_success
'A: verify pack' '
96 test_expect_success
'A: verify commit' '
98 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
99 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
103 git cat-file commit master | sed 1d >actual &&
104 test_cmp expect actual
107 test_expect_success
'A: verify tree' '
108 cat >expect <<-EOF &&
113 git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
114 test_cmp expect actual
117 test_expect_success
'A: verify file2' '
118 echo "$file2_data" >expect &&
119 git cat-file blob master:file2 >actual &&
120 test_cmp expect actual
123 test_expect_success
'A: verify file3' '
124 echo "$file3_data" >expect &&
125 git cat-file blob master:file3 >actual &&
126 test_cmp expect actual
129 test_expect_success
'A: verify file4' '
130 printf "$file4_data" >expect &&
131 git cat-file blob master:file4 >actual &&
132 test_cmp expect actual
135 test_expect_success
'A: verify tag/series-A' '
136 cat >expect <<-EOF &&
137 object $(git rev-parse refs/heads/master)
141 An annotated tag without a tagger
143 git cat-file tag tags/series-A >actual &&
144 test_cmp expect actual
147 test_expect_success
'A: verify tag/series-A-blob' '
148 cat >expect <<-EOF &&
149 object $(git rev-parse refs/heads/master:file3)
153 An annotated tag that annotates a blob.
155 git cat-file tag tags/series-A-blob >actual &&
156 test_cmp expect actual
159 test_expect_success
'A: verify marks output' '
160 cat >expect <<-EOF &&
161 :2 $(git rev-parse --verify master:file2)
162 :3 $(git rev-parse --verify master:file3)
163 :4 $(git rev-parse --verify master:file4)
164 :5 $(git rev-parse --verify master^0)
166 test_cmp expect marks.out
169 test_expect_success
'A: verify marks import' '
171 --import-marks=marks.out \
172 --export-marks=marks.new \
174 test_cmp expect marks.new
177 test_expect_success
'A: tag blob by sha1' '
179 new_blob=$(echo testing | git hash-object --stdin) &&
180 cat >input <<-INPUT_END &&
182 from $(git rev-parse refs/heads/master:file3)
193 commit refs/heads/new_blob
197 #pretend we got sha1 from fast-import
207 cat >expect <<-EOF &&
208 object $(git rev-parse refs/heads/master:file3)
220 git fast-import <input &&
221 git cat-file tag tags/series-A-blob-2 >actual &&
222 git cat-file tag tags/series-A-blob-3 >>actual &&
223 test_cmp expect actual
226 test_expect_success
'A: verify marks import does not crash' '
228 cat >input <<-INPUT_END &&
229 commit refs/heads/verify--import-marks
230 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
236 M 755 :2 copy-of-file2
240 git fast-import --import-marks=marks.out <input &&
241 git whatchanged verify--import-marks
244 test_expect_success
'A: verify pack' '
248 test_expect_success
'A: verify diff' '
249 cat >expect <<-EOF &&
250 :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
252 git diff-tree -M -r master verify--import-marks >actual &&
253 compare_diff_raw expect actual &&
254 test $(git rev-parse --verify master:file2) \
255 = $(git rev-parse --verify verify--import-marks:copy-of-file2)
258 test_expect_success
'A: export marks with large values' '
260 mt=$(git hash-object --stdin < /dev/null) &&
265 cat >input.commit <<-EOF &&
266 commit refs/heads/verify--dump-marks
267 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
269 test the sparse array dumping routines with exponentially growing marks
274 while test "$i" -lt 27
276 cat >>input.blob <<-EOF &&
287 echo "M 100644 :$l l$i" >>input.commit &&
288 echo "M 100644 :$m m$i" >>input.commit &&
289 echo "M 100644 :$n n$i" >>input.commit &&
291 echo ":$l $mt" >>marks.exp &&
292 echo ":$m $mt" >>marks.exp &&
293 echo ":$n $mt" >>marks.exp &&
295 printf "100644 blob $mt\tl$i\n" >>tree.exp &&
296 printf "100644 blob $mt\tm$i\n" >>tree.exp &&
297 printf "100644 blob $mt\tn$i\n" >>tree.exp &&
303 i=$((1 + $i)) || return 1
306 sort tree.exp > tree.exp_s &&
308 cat input.blob input.commit | git fast-import --export-marks=marks.large &&
309 git ls-tree refs/heads/verify--dump-marks >tree.out &&
310 test_cmp tree.exp_s tree.out &&
311 test_cmp marks.exp marks.large
318 test_expect_success
'B: fail on invalid blob sha1' '
320 cat >input <<-INPUT_END &&
321 commit refs/heads/branch
323 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
328 from refs/heads/master
329 M 755 0000000000000000000000000000000000000001 zero1
333 test_when_finished "rm -f .git/objects/pack_* .git/objects/index_*" &&
334 test_must_fail git fast-import <input
337 test_expect_success
'B: accept branch name "TEMP_TAG"' '
338 cat >input <<-INPUT_END &&
340 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
345 from refs/heads/master
349 test_when_finished "rm -f .git/TEMP_TAG
352 git fast-import <input &&
353 test -f .git/TEMP_TAG &&
354 test $(git rev-parse master) = $(git rev-parse TEMP_TAG^)
357 test_expect_success
'B: accept empty committer' '
358 cat >input <<-INPUT_END &&
359 commit refs/heads/empty-committer-1
360 committer <> $GIT_COMMITTER_DATE
366 test_when_finished "git update-ref -d refs/heads/empty-committer-1
369 git fast-import <input &&
375 test_expect_success
'B: accept and fixup committer with no name' '
376 cat >input <<-INPUT_END &&
377 commit refs/heads/empty-committer-2
378 committer <a@b.com> $GIT_COMMITTER_DATE
384 test_when_finished "git update-ref -d refs/heads/empty-committer-2
387 git fast-import <input &&
393 test_expect_success
'B: fail on invalid committer (1)' '
394 cat >input <<-INPUT_END &&
395 commit refs/heads/invalid-committer
396 committer Name email> $GIT_COMMITTER_DATE
402 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
403 test_must_fail git fast-import <input
406 test_expect_success
'B: fail on invalid committer (2)' '
407 cat >input <<-INPUT_END &&
408 commit refs/heads/invalid-committer
409 committer Name <e<mail> $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 (3)' '
420 cat >input <<-INPUT_END &&
421 commit refs/heads/invalid-committer
422 committer Name <email>> $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 (4)' '
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 (5)' '
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
462 test_expect_success
'C: incremental import create pack from stdin' '
463 newf=$(echo hi newf | git hash-object -w --stdin) &&
464 oldf=$(git rev-parse --verify master:file2) &&
466 cat >input <<-INPUT_END &&
467 commit refs/heads/branch
468 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
473 from refs/heads/master
474 M 644 $oldf file2/oldf
475 M 755 $newf file2/newf
480 git fast-import <input &&
481 git whatchanged branch
484 test_expect_success
'C: verify pack' '
488 test_expect_success
'C: validate reuse existing blob' '
489 test $newf = $(git rev-parse --verify branch:file2/newf) &&
490 test $oldf = $(git rev-parse --verify branch:file2/oldf)
493 test_expect_success
'C: verify commit' '
494 cat >expect <<-EOF &&
495 parent $(git rev-parse --verify master^0)
496 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
497 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
502 git cat-file commit branch | sed 1d >actual &&
503 test_cmp expect actual
506 test_expect_success
'C: validate rename result' '
507 cat >expect <<-EOF &&
508 :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
509 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
510 :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
512 git diff-tree -M -r master branch >actual &&
513 compare_diff_raw expect actual
520 test_expect_success
'D: inline data in commit' '
522 cat >input <<-INPUT_END &&
523 commit refs/heads/branch
524 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
529 from refs/heads/branch^0
530 M 644 inline newdir/interesting
535 M 755 inline newdir/exec.sh
542 git fast-import <input &&
543 git whatchanged branch
546 test_expect_success
'D: verify pack' '
550 test_expect_success
'D: validate new files added' '
551 cat >expect <<-EOF &&
552 :000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A newdir/exec.sh
553 :000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
555 git diff-tree -M -r branch^ branch >actual &&
556 compare_diff_raw expect actual
559 test_expect_success
'D: verify file5' '
560 echo "$file5_data" >expect &&
561 git cat-file blob branch:newdir/interesting >actual &&
562 test_cmp expect actual
565 test_expect_success
'D: verify file6' '
566 echo "$file6_data" >expect &&
567 git cat-file blob branch:newdir/exec.sh >actual &&
568 test_cmp expect actual
575 test_expect_success
'E: rfc2822 date, --date-format=raw' '
576 cat >input <<-INPUT_END &&
577 commit refs/heads/branch
578 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
579 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
584 from refs/heads/branch^0
588 test_must_fail git fast-import --date-format=raw <input
590 test_expect_success
'E: rfc2822 date, --date-format=rfc2822' '
591 git fast-import --date-format=rfc2822 <input
594 test_expect_success
'E: verify pack' '
598 test_expect_success
'E: verify commit' '
599 cat >expect <<-EOF &&
600 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
601 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
605 git cat-file commit branch | sed 1,2d >actual &&
606 test_cmp expect actual
613 test_expect_success
'F: non-fast-forward update skips' '
614 old_branch=$(git rev-parse --verify branch^0) &&
616 cat >input <<-INPUT_END &&
617 commit refs/heads/branch
618 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
620 losing things already?
623 from refs/heads/branch~1
625 reset refs/heads/other
626 from refs/heads/branch
630 test_must_fail git fast-import <input &&
631 # branch must remain unaffected
632 test $old_branch = $(git rev-parse --verify branch^0)
635 test_expect_success
'F: verify pack' '
639 test_expect_success
'F: verify other commit' '
640 cat >expect <<-EOF &&
641 tree $(git rev-parse branch~1^{tree})
642 parent $(git rev-parse branch~1)
643 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
644 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
646 losing things already?
648 git cat-file commit other >actual &&
649 test_cmp expect actual
656 test_expect_success
'G: non-fast-forward update forced' '
657 old_branch=$(git rev-parse --verify branch^0) &&
659 cat >input <<-INPUT_END &&
660 commit refs/heads/branch
661 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
663 losing things already?
666 from refs/heads/branch~1
669 git fast-import --force <input
672 test_expect_success
'G: verify pack' '
676 test_expect_success
'G: branch changed, but logged' '
677 test $old_branch != $(git rev-parse --verify branch^0) &&
678 test $old_branch = $(git rev-parse --verify branch@{1})
685 test_expect_success
'H: deletall, add 1' '
687 cat >input <<-INPUT_END &&
689 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
694 from refs/heads/branch^0
695 M 644 inline i-will-die
697 this file will never exist.
701 M 644 inline h/e/l/lo
707 git fast-import <input &&
711 test_expect_success
'H: verify pack' '
715 test_expect_success
'H: validate old files removed, new files added' '
716 cat >expect <<-EOF &&
717 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
718 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
719 :100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
720 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
721 :100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
723 git diff-tree -M -r H^ H >actual &&
724 compare_diff_raw expect actual
727 test_expect_success
'H: verify file' '
728 echo "$file5_data" >expect &&
729 git cat-file blob H:h/e/l/lo >actual &&
730 test_cmp expect actual
737 test_expect_success
'I: export-pack-edges' '
738 cat >input <<-INPUT_END &&
739 commit refs/heads/export-boundary
740 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
742 we have a border. its only 40 characters wide.
745 from refs/heads/branch
748 git fast-import --export-pack-edges=edges.list <input
751 test_expect_success
'I: verify edge list' '
752 cat >expect <<-EOF &&
753 .git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)
755 sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
756 test_cmp expect actual
763 test_expect_success
'J: reset existing branch creates empty commit' '
764 cat >input <<-INPUT_END &&
766 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
771 from refs/heads/branch
776 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
782 git fast-import <input
784 test_expect_success
'J: branch has 1 commit, empty tree' '
785 test 1 = $(git rev-list J | wc -l) &&
786 test 0 = $(git ls-tree J | wc -l)
789 test_expect_success
'J: tag must fail on empty branch' '
790 cat >input <<-INPUT_END &&
796 Tag branch that was reset.
799 test_must_fail git fast-import <input
806 test_expect_success
'K: reinit branch with from' '
807 cat >input <<-INPUT_END &&
809 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
814 from refs/heads/branch
817 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
822 from refs/heads/branch^1
825 git fast-import <input
827 test_expect_success
'K: verify K^1 = branch^1' '
828 test $(git rev-parse --verify branch^1) \
829 = $(git rev-parse --verify K^1)
836 test_expect_success
'L: verify internal tree sorting' '
837 cat >input <<-INPUT_END &&
851 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
861 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
871 cat >expect <<-EXPECT_END &&
872 :100644 100644 4268632... 55d3a52... M b.
873 :040000 040000 0ae5cac... 443c768... M b
874 :100644 100644 4268632... 55d3a52... M ba
877 git fast-import <input &&
878 git diff-tree --abbrev --raw L^ L >output &&
879 test_cmp expect output
882 test_expect_success
'L: nested tree copy does not corrupt deltas' '
883 cat >input <<-INPUT_END &&
891 committer C O Mitter <committer@example.com> 1112912473 -0700
900 committer C O Mitter <committer@example.com> 1112912473 -0700
909 cat >expect <<-\EOF &&
914 test_when_finished "git update-ref -d refs/heads/L2" &&
915 git fast-import <input &&
916 git ls-tree L2 g/b/ >tmp &&
917 cat tmp | cut -f 2 >actual &&
918 test_cmp expect actual &&
919 git fsck $(git rev-parse L2)
926 test_expect_success
'M: rename file in same subdirectory' '
928 cat >input <<-INPUT_END &&
930 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
935 from refs/heads/branch^0
936 R file2/newf file2/n.e.w.f
940 cat >expect <<-EOF &&
941 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
943 git fast-import <input &&
944 git diff-tree -M -r M1^ M1 >actual &&
945 compare_diff_raw expect actual
948 test_expect_success
'M: rename file to new subdirectory' '
949 cat >input <<-INPUT_END &&
951 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
956 from refs/heads/branch^0
957 R file2/newf i/am/new/to/you
961 cat >expect <<-EOF &&
962 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
964 git fast-import <input &&
965 git diff-tree -M -r M2^ M2 >actual &&
966 compare_diff_raw expect actual
969 test_expect_success
'M: rename subdirectory to new subdirectory' '
970 cat >input <<-INPUT_END &&
972 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
982 cat >expect <<-EOF &&
983 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
985 git fast-import <input &&
986 git diff-tree -M -r M3^ M3 >actual &&
987 compare_diff_raw expect actual
990 test_expect_success
'M: rename root to subdirectory' '
991 cat >input <<-INPUT_END &&
993 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1003 cat >expect <<-EOF &&
1004 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2/oldf sub/file2/oldf
1005 :100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 R100 file4 sub/file4
1006 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you sub/i/am/new/to/you
1007 :100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 R100 newdir/exec.sh sub/newdir/exec.sh
1008 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting sub/newdir/interesting
1010 git fast-import <input &&
1011 git diff-tree -M -r M4^ M4 >actual &&
1013 compare_diff_raw expect actual
1020 test_expect_success
'N: copy file in same subdirectory' '
1022 cat >input <<-INPUT_END &&
1023 commit refs/heads/N1
1024 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1029 from refs/heads/branch^0
1030 C file2/newf file2/n.e.w.f
1034 cat >expect <<-EOF &&
1035 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
1037 git fast-import <input &&
1038 git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
1039 compare_diff_raw expect actual
1042 test_expect_success
'N: copy then modify subdirectory' '
1043 cat >input <<-INPUT_END &&
1044 commit refs/heads/N2
1045 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1047 clean directory copy
1050 from refs/heads/branch^0
1053 commit refs/heads/N2
1054 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1056 modify directory copy
1059 M 644 inline file3/file5
1066 cat >expect <<-EOF &&
1067 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
1068 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1069 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1071 git fast-import <input &&
1072 git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
1073 compare_diff_raw expect actual
1076 test_expect_success
'N: copy dirty subdirectory' '
1077 cat >input <<-INPUT_END &&
1078 commit refs/heads/N3
1079 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1081 dirty directory copy
1084 from refs/heads/branch^0
1085 M 644 inline file2/file5
1095 git fast-import <input &&
1096 test $(git rev-parse N2^{tree}) = $(git rev-parse N3^{tree})
1099 test_expect_success
'N: copy directory by id' '
1100 cat >expect <<-\EOF &&
1101 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1102 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1104 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1105 cat >input <<-INPUT_END &&
1106 commit refs/heads/N4
1107 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1112 from refs/heads/branch^0
1113 M 040000 $subdir file3
1115 git fast-import <input &&
1116 git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
1117 compare_diff_raw expect actual
1120 test_expect_success PIPE
'N: read and copy directory' '
1121 cat >expect <<-\EOF &&
1122 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1123 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1125 git update-ref -d refs/heads/N4 &&
1131 commit refs/heads/N4
1132 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1134 copy by tree hash, part 2
1137 from refs/heads/branch^0
1140 read mode type tree filename &&
1141 echo "M 040000 $tree file3"
1143 git fast-import --cat-blob-fd=3 3>backflow &&
1144 git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
1145 compare_diff_raw expect actual
1148 test_expect_success PIPE
'N: empty directory reads as missing' '
1149 cat <<-\EOF >expect &&
1151 :000000 100644 OBJNAME OBJNAME A unrelated
1153 echo "missing src" >expect.response &&
1154 git update-ref -d refs/heads/read-empty &&
1160 commit refs/heads/read-empty
1161 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1163 read "empty" (missing) directory
1166 M 100644 inline src/greeting
1170 C src/greeting dst1/non-greeting
1171 C src/greeting unrelated
1172 # leave behind "empty" src directory
1177 printf "%s\n" "$line" >response &&
1183 git fast-import --cat-blob-fd=3 3>backflow &&
1184 test_cmp expect.response response &&
1185 git rev-list read-empty |
1186 git diff-tree -r --root --stdin |
1187 sed "s/$_x40/OBJNAME/g" >actual &&
1188 test_cmp expect actual
1191 test_expect_success
'N: copy root directory by tree hash' '
1192 cat >expect <<-\EOF &&
1193 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file3/newf
1194 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file3/oldf
1196 root=$(git rev-parse refs/heads/branch^0^{tree}) &&
1197 cat >input <<-INPUT_END &&
1198 commit refs/heads/N6
1199 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1201 copy root directory by tree hash
1204 from refs/heads/branch^0
1207 git fast-import <input &&
1208 git diff-tree -C --find-copies-harder -r N4 N6 >actual &&
1209 compare_diff_raw expect actual
1212 test_expect_success
'N: copy root by path' '
1213 cat >expect <<-\EOF &&
1214 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf oldroot/file2/newf
1215 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf oldroot/file2/oldf
1216 :100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 C100 file4 oldroot/file4
1217 :100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 C100 newdir/exec.sh oldroot/newdir/exec.sh
1218 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting oldroot/newdir/interesting
1220 cat >input <<-INPUT_END &&
1221 commit refs/heads/N-copy-root-path
1222 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1224 copy root directory by (empty) path
1227 from refs/heads/branch^0
1230 git fast-import <input &&
1231 git diff-tree -C --find-copies-harder -r branch N-copy-root-path >actual &&
1232 compare_diff_raw expect actual
1235 test_expect_success
'N: delete directory by copying' '
1236 cat >expect <<-\EOF &&
1238 :100644 000000 OBJID OBJID D foo/bar/qux
1240 :000000 100644 OBJID OBJID A foo/bar/baz
1241 :000000 100644 OBJID OBJID A foo/bar/qux
1243 empty_tree=$(git mktree </dev/null) &&
1244 cat >input <<-INPUT_END &&
1245 commit refs/heads/N-delete
1246 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1248 collect data to be deleted
1252 M 100644 inline foo/bar/baz
1256 C "foo/bar/baz" "foo/bar/qux"
1257 C "foo/bar/baz" "foo/bar/quux/1"
1258 C "foo/bar/baz" "foo/bar/quuux"
1259 M 040000 $empty_tree foo/bar/quux
1260 M 040000 $empty_tree foo/bar/quuux
1262 commit refs/heads/N-delete
1263 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1268 M 040000 $empty_tree foo/bar/qux
1270 git fast-import <input &&
1271 git rev-list N-delete |
1272 git diff-tree -r --stdin --root --always |
1273 sed -e "s/$_x40/OBJID/g" >actual &&
1274 test_cmp expect actual
1277 test_expect_success
'N: modify copied tree' '
1278 cat >expect <<-\EOF &&
1279 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
1280 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1281 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1283 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1284 cat >input <<-INPUT_END &&
1285 commit refs/heads/N5
1286 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1291 from refs/heads/branch^0
1292 M 040000 $subdir file3
1294 commit refs/heads/N5
1295 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1297 modify directory copy
1300 M 644 inline file3/file5
1305 git fast-import <input &&
1306 git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&
1307 compare_diff_raw expect actual
1310 test_expect_success
'N: reject foo/ syntax' '
1311 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1312 test_must_fail git fast-import <<-INPUT_END
1313 commit refs/heads/N5B
1314 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1316 copy with invalid syntax
1319 from refs/heads/branch^0
1320 M 040000 $subdir file3/
1324 test_expect_success
'N: reject foo/ syntax in copy source' '
1325 test_must_fail git fast-import <<-INPUT_END
1326 commit refs/heads/N5C
1327 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1329 copy with invalid syntax
1332 from refs/heads/branch^0
1337 test_expect_success
'N: reject foo/ syntax in rename source' '
1338 test_must_fail git fast-import <<-INPUT_END
1339 commit refs/heads/N5D
1340 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1342 rename with invalid syntax
1345 from refs/heads/branch^0
1350 test_expect_success
'N: reject foo/ syntax in ls argument' '
1351 test_must_fail git fast-import <<-INPUT_END
1352 commit refs/heads/N5E
1353 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1355 copy with invalid syntax
1358 from refs/heads/branch^0
1363 test_expect_success
'N: copy to root by id and modify' '
1364 echo "hello, world" >expect.foo &&
1365 echo hello >expect.bar &&
1366 git fast-import <<-SETUP_END &&
1367 commit refs/heads/N7
1368 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1374 M 644 inline foo/bar
1380 tree=$(git rev-parse --verify N7:) &&
1381 git fast-import <<-INPUT_END &&
1382 commit refs/heads/N8
1383 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1385 copy to root by id and modify
1389 M 644 inline foo/foo
1394 git show N8:foo/foo >actual.foo &&
1395 git show N8:foo/bar >actual.bar &&
1396 test_cmp expect.foo actual.foo &&
1397 test_cmp expect.bar actual.bar
1400 test_expect_success
'N: extract subtree' '
1401 branch=$(git rev-parse --verify refs/heads/branch^{tree}) &&
1402 cat >input <<-INPUT_END &&
1403 commit refs/heads/N9
1404 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1406 extract subtree branch:newdir
1412 git fast-import <input &&
1413 git diff --exit-code branch:newdir N9
1416 test_expect_success
'N: modify subtree, extract it, and modify again' '
1417 echo hello >expect.baz &&
1418 echo hello, world >expect.qux &&
1419 git fast-import <<-SETUP_END &&
1420 commit refs/heads/N10
1421 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1427 M 644 inline foo/bar/baz
1433 tree=$(git rev-parse --verify N10:) &&
1434 git fast-import <<-INPUT_END &&
1435 commit refs/heads/N11
1436 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1438 copy to root by id and modify
1442 M 100644 inline foo/bar/qux
1447 C "bar/qux" "bar/quux"
1449 git show N11:bar/baz >actual.baz &&
1450 git show N11:bar/qux >actual.qux &&
1451 git show N11:bar/quux >actual.quux &&
1452 test_cmp expect.baz actual.baz &&
1453 test_cmp expect.qux actual.qux &&
1454 test_cmp expect.qux actual.quux'
1460 test_expect_success
'O: comments are all skipped' '
1461 cat >input <<-INPUT_END &&
1463 commit refs/heads/O1
1464 # -- ignore all of this text
1465 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1466 # $GIT_COMMITTER_NAME has inserted here for his benefit.
1468 dirty directory copy
1471 # do not forget the import blank line!
1473 # yes, we started from our usual base of branch^0.
1475 from refs/heads/branch^0
1476 # and we need to reuse file2/file5 from N3 above.
1477 M 644 inline file2/file5
1478 # otherwise the tree will be different
1483 # do not forget to copy file2 to file3
1486 # or to delete file5 from file2.
1492 git fast-import <input &&
1493 test $(git rev-parse N3) = $(git rev-parse O1)
1496 test_expect_success
'O: blank lines not necessary after data commands' '
1497 cat >input <<-INPUT_END &&
1498 commit refs/heads/O2
1499 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1501 dirty directory copy
1503 from refs/heads/branch^0
1504 M 644 inline file2/file5
1513 git fast-import <input &&
1514 test $(git rev-parse N3) = $(git rev-parse O2)
1517 test_expect_success
'O: repack before next test' '
1521 test_expect_success
'O: blank lines not necessary after other commands' '
1522 cat >input <<-INPUT_END &&
1523 commit refs/heads/O3
1524 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1528 commit refs/heads/O3
1529 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1534 commit refs/heads/O3
1536 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
1546 reset refs/tags/O3-2nd
1548 reset refs/tags/O3-3rd
1552 cat >expect <<-INPUT_END &&
1559 git fast-import <input &&
1560 test 8 = $(find .git/objects/pack -type f | wc -l) &&
1561 test $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&
1562 git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
1563 test_cmp expect actual
1566 test_expect_success
'O: progress outputs as requested by input' '
1567 cat >input <<-INPUT_END &&
1568 commit refs/heads/O4
1569 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1573 commit refs/heads/O4
1574 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1578 progress Two commits down, 2 to go!
1579 commit refs/heads/O4
1580 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1584 progress Three commits down, 1 to go!
1585 commit refs/heads/O4
1586 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1592 git fast-import <input >actual &&
1593 grep "progress " <input >expect &&
1594 test_cmp expect actual
1598 ### series P (gitlinks)
1601 test_expect_success
'P: superproject & submodule mix' '
1602 cat >input <<-INPUT_END &&
1608 reset refs/heads/sub
1609 commit refs/heads/sub
1611 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1624 commit refs/heads/subuse1
1626 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1629 from refs/heads/master
1630 M 100644 :3 .gitmodules
1639 commit refs/heads/sub
1641 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1647 commit refs/heads/subuse1
1649 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1657 git fast-import <input &&
1658 git checkout subuse1 &&
1664 git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
1667 git submodule init &&
1668 git submodule update
1671 test_expect_success
'P: verbatim SHA gitlinks' '
1672 SUBLAST=$(git rev-parse --verify sub) &&
1673 SUBPREV=$(git rev-parse --verify sub^) &&
1675 cat >input <<-INPUT_END &&
1684 commit refs/heads/subuse2
1686 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1689 from refs/heads/master
1690 M 100644 :1 .gitmodules
1691 M 160000 $SUBPREV sub
1693 commit refs/heads/subuse2
1695 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1699 M 160000 $SUBLAST sub
1703 git branch -D sub &&
1706 git fast-import <input &&
1707 test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
1710 test_expect_success
'P: fail on inline gitlink' '
1712 cat >input <<-INPUT_END &&
1713 commit refs/heads/subuse3
1715 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1720 from refs/heads/subuse2
1728 test_must_fail git fast-import <input
1731 test_expect_success
'P: fail on blob mark in gitlink' '
1733 cat >input <<-INPUT_END &&
1740 commit refs/heads/subuse3
1742 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1747 from refs/heads/subuse2
1752 test_must_fail git fast-import <input
1756 ### series Q (notes)
1759 test_expect_success
'Q: commit notes' '
1760 note1_data="The first note for the first commit" &&
1761 note2_data="The first note for the second commit" &&
1762 note3_data="The first note for the third commit" &&
1763 note1b_data="The second note for the first commit" &&
1764 note1c_data="The third note for the first commit" &&
1765 note2b_data="The second note for the second commit" &&
1768 cat >input <<-INPUT_END &&
1775 commit refs/heads/notes-test
1777 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1788 commit refs/heads/notes-test
1790 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1797 commit refs/heads/notes-test
1799 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1826 commit refs/notes/foobar
1828 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1840 commit refs/notes/foobar
1842 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1852 commit refs/notes/foobar2
1854 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1864 commit refs/notes/foobar
1866 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1879 git fast-import <input &&
1880 git whatchanged notes-test
1883 test_expect_success
'Q: verify pack' '
1887 test_expect_success
'Q: verify first commit' '
1888 commit1=$(git rev-parse notes-test~2) &&
1889 commit2=$(git rev-parse notes-test^) &&
1890 commit3=$(git rev-parse notes-test) &&
1892 cat >expect <<-EOF &&
1893 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1894 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1898 git cat-file commit notes-test~2 | sed 1d >actual &&
1899 test_cmp expect actual
1902 test_expect_success
'Q: verify second commit' '
1903 cat >expect <<-EOF &&
1905 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1906 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1910 git cat-file commit notes-test^ | sed 1d >actual &&
1911 test_cmp expect actual
1914 test_expect_success
'Q: verify third commit' '
1915 cat >expect <<-EOF &&
1917 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1918 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1922 git cat-file commit notes-test | sed 1d >actual &&
1923 test_cmp expect actual
1926 test_expect_success
'Q: verify first notes commit' '
1927 cat >expect <<-EOF &&
1928 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1929 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1933 git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&
1934 test_cmp expect actual
1937 test_expect_success
'Q: verify first notes tree' '
1938 cat >expect.unsorted <<-EOF &&
1939 100644 blob $commit1
1940 100644 blob $commit2
1941 100644 blob $commit3
1943 cat expect.unsorted | sort >expect &&
1944 git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1945 test_cmp expect actual
1948 test_expect_success
'Q: verify first note for first commit' '
1949 echo "$note1_data" >expect &&
1950 git cat-file blob refs/notes/foobar~2:$commit1 >actual &&
1951 test_cmp expect actual
1954 test_expect_success
'Q: verify first note for second commit' '
1955 echo "$note2_data" >expect &&
1956 git cat-file blob refs/notes/foobar~2:$commit2 >actual &&
1957 test_cmp expect actual
1960 test_expect_success
'Q: verify first note for third commit' '
1961 echo "$note3_data" >expect &&
1962 git cat-file blob refs/notes/foobar~2:$commit3 >actual &&
1963 test_cmp expect actual
1966 test_expect_success
'Q: verify second notes commit' '
1967 cat >expect <<-EOF &&
1968 parent $(git rev-parse --verify refs/notes/foobar~2)
1969 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1970 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1974 git cat-file commit refs/notes/foobar^ | sed 1d >actual &&
1975 test_cmp expect actual
1978 test_expect_success
'Q: verify second notes tree' '
1979 cat >expect.unsorted <<-EOF &&
1980 100644 blob $commit1
1981 100644 blob $commit2
1982 100644 blob $commit3
1984 cat expect.unsorted | sort >expect &&
1985 git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1986 test_cmp expect actual
1989 test_expect_success
'Q: verify second note for first commit' '
1990 echo "$note1b_data" >expect &&
1991 git cat-file blob refs/notes/foobar^:$commit1 >actual &&
1992 test_cmp expect actual
1995 test_expect_success
'Q: verify first note for second commit' '
1996 echo "$note2_data" >expect &&
1997 git cat-file blob refs/notes/foobar^:$commit2 >actual &&
1998 test_cmp expect actual
2001 test_expect_success
'Q: verify first note for third commit' '
2002 echo "$note3_data" >expect &&
2003 git cat-file blob refs/notes/foobar^:$commit3 >actual &&
2004 test_cmp expect actual
2007 test_expect_success
'Q: verify third notes commit' '
2008 cat >expect <<-EOF &&
2009 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2010 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2014 git cat-file commit refs/notes/foobar2 | sed 1d >actual &&
2015 test_cmp expect actual
2018 test_expect_success
'Q: verify third notes tree' '
2019 cat >expect.unsorted <<-EOF &&
2020 100644 blob $commit1
2022 cat expect.unsorted | sort >expect &&
2023 git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2024 test_cmp expect actual
2027 test_expect_success
'Q: verify third note for first commit' '
2028 echo "$note1c_data" >expect &&
2029 git cat-file blob refs/notes/foobar2:$commit1 >actual &&
2030 test_cmp expect actual
2033 test_expect_success
'Q: verify fourth notes commit' '
2034 cat >expect <<-EOF &&
2035 parent $(git rev-parse --verify refs/notes/foobar^)
2036 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2037 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2041 git cat-file commit refs/notes/foobar | sed 1d >actual &&
2042 test_cmp expect actual
2045 test_expect_success
'Q: verify fourth notes tree' '
2046 cat >expect.unsorted <<-EOF &&
2047 100644 blob $commit2
2049 cat expect.unsorted | sort >expect &&
2050 git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2051 test_cmp expect actual
2054 test_expect_success
'Q: verify second note for second commit' '
2055 echo "$note2b_data" >expect &&
2056 git cat-file blob refs/notes/foobar:$commit2 >actual &&
2057 test_cmp expect actual
2060 test_expect_success
'Q: deny note on empty branch' '
2061 cat >input <<-EOF &&
2064 commit refs/heads/note-Q0
2065 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2067 Note for an empty branch.
2070 N inline refs/heads/Q0
2075 test_must_fail git fast-import <input
2078 ### series R (feature and option)
2081 test_expect_success
'R: abort on unsupported feature' '
2082 cat >input <<-EOF &&
2083 feature no-such-feature-exists
2086 test_must_fail git fast-import <input
2089 test_expect_success
'R: supported feature is accepted' '
2090 cat >input <<-EOF &&
2091 feature date-format=now
2094 git fast-import <input
2097 test_expect_success
'R: abort on receiving feature after data command' '
2098 cat >input <<-EOF &&
2102 feature date-format=now
2105 test_must_fail git fast-import <input
2108 test_expect_success
'R: only one import-marks feature allowed per stream' '
2109 cat >input <<-EOF &&
2110 feature import-marks=git.marks
2111 feature import-marks=git2.marks
2114 test_must_fail git fast-import <input
2117 test_expect_success
'R: export-marks feature results in a marks file being created' '
2118 cat >input <<-EOF &&
2119 feature export-marks=git.marks
2127 cat input | git fast-import &&
2131 test_expect_success
'R: export-marks options can be overridden by commandline options' '
2132 cat input | git fast-import --export-marks=other.marks &&
2136 test_expect_success
'R: catch typo in marks file name' '
2137 test_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&
2138 echo "feature import-marks=nonexistent.marks" |
2139 test_must_fail git fast-import
2142 test_expect_success
'R: import and output marks can be the same file' '
2144 blob=$(echo hi | git hash-object --stdin) &&
2145 cat >expect <<-EOF &&
2149 git fast-import --export-marks=io.marks <<-\EOF &&
2156 git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF &&
2163 test_cmp expect io.marks
2166 test_expect_success
'R: --import-marks=foo --output-marks=foo to create foo fails' '
2168 test_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF
2177 test_expect_success
'R: --import-marks-if-exists' '
2179 blob=$(echo hi | git hash-object --stdin) &&
2180 echo ":1 $blob" >expect &&
2181 git fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\EOF &&
2188 test_cmp expect io.marks
2191 test_expect_success
'R: feature import-marks-if-exists' '
2195 git fast-import --export-marks=io.marks <<-\EOF &&
2196 feature import-marks-if-exists=not_io.marks
2198 test_cmp expect io.marks &&
2200 blob=$(echo hi | git hash-object --stdin) &&
2202 echo ":1 $blob" >io.marks &&
2203 echo ":1 $blob" >expect &&
2204 echo ":2 $blob" >>expect &&
2206 git fast-import --export-marks=io.marks <<-\EOF &&
2207 feature import-marks-if-exists=io.marks
2214 test_cmp expect io.marks &&
2216 echo ":3 $blob" >>expect &&
2218 git fast-import --import-marks=io.marks \
2219 --export-marks=io.marks <<-\EOF &&
2220 feature import-marks-if-exists=not_io.marks
2227 test_cmp expect io.marks &&
2231 git fast-import --import-marks-if-exists=not_io.marks \
2232 --export-marks=io.marks <<-\EOF &&
2233 feature import-marks-if-exists=io.marks
2235 test_cmp expect io.marks
2238 test_expect_success
'R: import to output marks works without any content' '
2239 cat >input <<-EOF &&
2240 feature import-marks=marks.out
2241 feature export-marks=marks.new
2244 cat input | git fast-import &&
2245 test_cmp marks.out marks.new
2248 test_expect_success
'R: import marks prefers commandline marks file over the stream' '
2249 cat >input <<-EOF &&
2250 feature import-marks=nonexistent.marks
2251 feature export-marks=marks.new
2254 cat input | git fast-import --import-marks=marks.out &&
2255 test_cmp marks.out marks.new
2259 test_expect_success
'R: multiple --import-marks= should be honoured' '
2260 cat >input <<-EOF &&
2261 feature import-marks=nonexistent.marks
2262 feature export-marks=combined.marks
2265 head -n2 marks.out > one.marks &&
2266 tail -n +3 marks.out > two.marks &&
2267 git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
2268 test_cmp marks.out combined.marks
2271 test_expect_success
'R: feature relative-marks should be honoured' '
2272 cat >input <<-EOF &&
2273 feature relative-marks
2274 feature import-marks=relative.in
2275 feature export-marks=relative.out
2278 mkdir -p .git/info/fast-import/ &&
2279 cp marks.new .git/info/fast-import/relative.in &&
2280 git fast-import <input &&
2281 test_cmp marks.new .git/info/fast-import/relative.out
2284 test_expect_success
'R: feature no-relative-marks should be honoured' '
2285 cat >input <<-EOF &&
2286 feature relative-marks
2287 feature import-marks=relative.in
2288 feature no-relative-marks
2289 feature export-marks=non-relative.out
2292 git fast-import <input &&
2293 test_cmp marks.new non-relative.out
2296 test_expect_success
'R: feature ls supported' '
2301 test_expect_success
'R: feature cat-blob supported' '
2302 echo "feature cat-blob" |
2306 test_expect_success
'R: cat-blob-fd must be a nonnegative integer' '
2307 test_must_fail git fast-import --cat-blob-fd=-1 </dev/null
2310 test_expect_success
!MINGW
'R: print old blob' '
2311 blob=$(echo "yes it can" | git hash-object -w --stdin) &&
2312 cat >expect <<-EOF &&
2317 echo "cat-blob $blob" |
2318 git fast-import --cat-blob-fd=6 6>actual &&
2319 test_cmp expect actual
2322 test_expect_success
!MINGW
'R: in-stream cat-blob-fd not respected' '
2323 echo hello >greeting &&
2324 blob=$(git hash-object -w greeting) &&
2325 cat >expect <<-EOF &&
2330 git fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&
2333 test_cmp expect actual.3 &&
2334 test_must_be_empty actual.1 &&
2335 git fast-import 3>actual.3 >actual.1 <<-EOF &&
2336 option cat-blob-fd=3
2339 test_must_be_empty actual.3 &&
2340 test_cmp expect actual.1
2343 test_expect_success
!MINGW
'R: print mark for new blob' '
2344 echo "effluentish" | git hash-object --stdin >expect &&
2345 git fast-import --cat-blob-fd=6 6>actual <<-\EOF &&
2353 test_cmp expect actual
2356 test_expect_success
!MINGW
'R: print new blob' '
2357 blob=$(echo "yep yep yep" | git hash-object --stdin) &&
2358 cat >expect <<-EOF &&
2363 git fast-import --cat-blob-fd=6 6>actual <<-\EOF &&
2371 test_cmp expect actual
2374 test_expect_success
!MINGW
'R: print new blob by sha1' '
2375 blob=$(echo "a new blob named by sha1" | git hash-object --stdin) &&
2376 cat >expect <<-EOF &&
2378 a new blob named by sha1
2381 git fast-import --cat-blob-fd=6 6>actual <<-EOF &&
2384 a new blob named by sha1
2388 test_cmp expect actual
2391 test_expect_success
'setup: big file' '
2393 echo "the quick brown fox jumps over the lazy dog" >big &&
2396 cat big big big big >bigger &&
2397 cat bigger bigger bigger bigger >big ||
2403 test_expect_success
'R: print two blobs to stdout' '
2404 blob1=$(git hash-object big) &&
2405 blob1_len=$(wc -c <big) &&
2406 blob2=$(echo hello | git hash-object --stdin) &&
2408 echo ${blob1} blob $blob1_len &&
2418 cat <<-\END_PART1 &&
2435 git fast-import >actual &&
2436 test_cmp expect actual
2439 test_expect_success PIPE
'R: copy using cat-file' '
2440 expect_id=$(git hash-object big) &&
2441 expect_len=$(wc -c <big) &&
2442 echo $expect_id blob $expect_len >expect.response &&
2445 cat >frontend <<-\FRONTEND_END &&
2451 export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&
2464 read blob_id type size <&3 &&
2465 echo "$blob_id $type $size" >response &&
2466 test_copy_bytes $size >blob <&3 &&
2470 commit refs/heads/copied
2471 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2473 copy big file as file3
2481 git fast-import --cat-blob-fd=3 3>blobs &&
2482 git show copied:file3 >actual &&
2483 test_cmp expect.response response &&
2487 test_expect_success PIPE
'R: print blob mid-commit' '
2489 echo "A blob from _before_ the commit." >expect &&
2498 A blob from _before_ the commit.
2500 commit refs/heads/temporary
2501 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2508 read blob_id type size <&3 &&
2509 test_copy_bytes $size >actual <&3 &&
2514 git fast-import --cat-blob-fd=3 3>blobs &&
2515 test_cmp expect actual
2518 test_expect_success PIPE
'R: print staged blob within commit' '
2520 echo "A blob from _within_ the commit." >expect &&
2526 commit refs/heads/within
2527 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2533 A blob from _within_ the commit.
2538 echo "A blob from _within_ the commit." |
2539 git hash-object --stdin
2541 echo "cat-blob $to_get" &&
2543 read blob_id type size <&3 &&
2544 test_copy_bytes $size >actual <&3 &&
2549 git fast-import --cat-blob-fd=3 3>blobs &&
2550 test_cmp expect actual
2553 test_expect_success
'R: quiet option results in no stats being output' '
2554 cat >input <<-EOF &&
2562 cat input | git fast-import 2> output &&
2563 test_must_be_empty output
2566 test_expect_success
'R: feature done means terminating "done" is mandatory' '
2567 echo feature done | test_must_fail git fast-import &&
2568 test_must_fail git fast-import --done </dev/null
2571 test_expect_success
'R: terminating "done" with trailing gibberish is ok' '
2572 git fast-import <<-\EOF &&
2577 git fast-import <<-\EOF
2579 more trailing gibberish
2583 test_expect_success
'R: terminating "done" within commit' '
2584 cat >expect <<-\EOF &&
2586 :000000 100644 OBJID OBJID A hello.c
2587 :000000 100644 OBJID OBJID A hello2.c
2589 git fast-import <<-EOF &&
2590 commit refs/heads/done-ends
2591 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2593 Commit terminated by "done" command
2595 M 100644 inline hello.c
2602 git rev-list done-ends |
2603 git diff-tree -r --stdin --root --always |
2604 sed -e "s/$_x40/OBJID/g" >actual &&
2605 test_cmp expect actual
2608 test_expect_success
'R: die on unknown option' '
2609 cat >input <<-EOF &&
2610 option git non-existing-option
2613 test_must_fail git fast-import <input
2616 test_expect_success
'R: unknown commandline options are rejected' '\
2617 test_must_fail git fast-import --non-existing-option < /dev/null
2620 test_expect_success
'R: die on invalid option argument' '
2621 echo "option git active-branches=-5" |
2622 test_must_fail git fast-import &&
2623 echo "option git depth=" |
2624 test_must_fail git fast-import &&
2625 test_must_fail git fast-import --depth="5 elephants" </dev/null
2628 test_expect_success
'R: ignore non-git options' '
2629 cat >input <<-EOF &&
2630 option non-existing-vcs non-existing-option
2633 git fast-import <input
2636 test_expect_success
'R: corrupt lines do not mess marks file' '
2638 blob=$(echo hi | git hash-object --stdin) &&
2639 cat >expect <<-EOF &&
2640 :3 0000000000000000000000000000000000000000
2644 cp expect io.marks &&
2645 test_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF &&
2648 test_cmp expect io.marks
2652 ## R: very large blobs
2654 test_expect_success
'R: blob bigger than threshold' '
2655 blobsize=$((2*1024*1024 + 53)) &&
2656 test-genrandom bar $blobsize >expect &&
2657 cat >input <<-INPUT_END &&
2658 commit refs/heads/big-file
2659 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2667 cat expect >>input &&
2668 cat >>input <<-INPUT_END &&
2672 cat expect >>input &&
2675 test_create_repo R &&
2676 git --git-dir=R/.git fast-import --big-file-threshold=1 <input
2679 test_expect_success
'R: verify created pack' '
2682 verify_packs -v > ../verify
2686 test_expect_success
'R: verify written objects' '
2687 git --git-dir=R/.git cat-file blob big-file:big1 >actual &&
2688 test_cmp_bin expect actual &&
2689 a=$(git --git-dir=R/.git rev-parse big-file:big1) &&
2690 b=$(git --git-dir=R/.git rev-parse big-file:big2) &&
2694 test_expect_success
'R: blob appears only once' '
2695 n=$(grep $a verify | wc -l) &&
2703 # Make sure missing spaces and EOLs after mark references
2712 # commit marks: 301, 302, 303, 304
2713 # blob marks: 403, 404, resp.
2716 # The error message when a space is missing not at the
2717 # end of the line is:
2719 # Missing space after ..
2721 # or when extra characters come after the mark at the end
2726 # or when the dataref is neither "inline " or a known SHA1,
2728 # Invalid dataref ..
2730 test_expect_success
'S: initialize for S tests' '
2733 cat >input <<-INPUT_END &&
2736 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2740 M 100644 inline hello.c
2747 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2752 M 100644 inline hello.c
2770 git fast-import --export-marks=marks <input
2774 # filemodify, three datarefs
2776 test_expect_success
'S: filemodify with garbage after mark must fail' '
2777 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2779 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2783 M 100644 :403x hello.c
2786 test_i18ngrep "space after mark" err
2789 # inline is misspelled; fast-import thinks it is some unknown dataref
2790 test_expect_success
'S: filemodify with garbage after inline must fail' '
2791 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2793 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2797 M 100644 inlineX hello.c
2803 test_i18ngrep "nvalid dataref" err
2806 test_expect_success
'S: filemodify with garbage after sha1 must fail' '
2807 sha1=$(grep :403 marks | cut -d\ -f2) &&
2808 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2810 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2814 M 100644 ${sha1}x hello.c
2817 test_i18ngrep "space after SHA1" err
2821 # notemodify, three ways to say dataref
2823 test_expect_success
'S: notemodify with garabge after mark dataref must fail' '
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 markref
2833 test_i18ngrep "space after mark" err
2836 test_expect_success
'S: notemodify with garbage after inline dataref must fail' '
2837 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2839 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2841 commit S note dataref inline
2849 test_i18ngrep "nvalid dataref" err
2852 test_expect_success
'S: notemodify with garbage after sha1 dataref must fail' '
2853 sha1=$(grep :202 marks | cut -d\ -f2) &&
2854 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2856 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2858 commit S note dataref sha1
2863 test_i18ngrep "space after SHA1" err
2867 # notemodify, mark in commit-ish
2869 test_expect_success
'S: notemodify with garbage after mark commit-ish must fail' '
2870 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2871 commit refs/heads/Snotes
2872 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2874 commit S note commit-ish
2879 test_i18ngrep "after mark" err
2885 test_expect_success
'S: from with garbage after mark must fail' '
2887 git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&
2888 commit refs/heads/S2
2890 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2895 M 100644 :403 hello.c
2899 # go create the commit, need it for merge test
2900 git fast-import --import-marks=marks --export-marks=marks <<-EOF &&
2901 commit refs/heads/S2
2903 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2908 M 100644 :403 hello.c
2911 # now evaluate the error
2913 test_i18ngrep "after mark" err
2920 test_expect_success
'S: merge with garbage after mark must fail' '
2921 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2924 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2930 M 100644 :403 hello.c
2933 test_i18ngrep "after mark" err
2939 test_expect_success
'S: tag with garbage after mark must fail' '
2940 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2943 tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2949 test_i18ngrep "after mark" err
2955 test_expect_success
'S: cat-blob with garbage after mark must fail' '
2956 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2960 test_i18ngrep "after mark" err
2966 test_expect_success
'S: ls with garbage after mark must fail' '
2967 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2971 test_i18ngrep "space after mark" err
2974 test_expect_success
'S: ls with garbage after sha1 must fail' '
2975 sha1=$(grep :302 marks | cut -d\ -f2) &&
2976 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2980 test_i18ngrep "space after tree-ish" err
2986 # Setup is carried over from series S.
2988 test_expect_success
'T: ls root tree' '
2989 sed -e "s/Z\$//" >expect <<-EOF &&
2990 040000 tree $(git rev-parse S^{tree}) Z
2992 sha1=$(git rev-parse --verify S) &&
2993 git fast-import --import-marks=marks <<-EOF >actual &&
2996 test_cmp expect actual
2999 test_expect_success
'T: delete branch' '
3000 git branch to-delete &&
3001 git fast-import <<-EOF &&
3002 reset refs/heads/to-delete
3003 from 0000000000000000000000000000000000000000
3005 test_must_fail git rev-parse --verify refs/heads/to-delete
3008 test_expect_success
'T: empty reset doesnt delete branch' '
3009 git branch not-to-delete &&
3010 git fast-import <<-EOF &&
3011 reset refs/heads/not-to-delete
3014 git rev-parse --verify refs/heads/not-to-delete
3018 ### series U (filedelete)
3021 test_expect_success
'U: initialize for U tests' '
3022 cat >input <<-INPUT_END &&
3024 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3028 M 100644 inline hello.c
3032 M 100644 inline good/night.txt
3036 M 100644 inline good/bye.txt
3043 git fast-import <input
3046 test_expect_success
'U: filedelete file succeeds' '
3047 cat >input <<-INPUT_END &&
3049 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3051 delete good/night.txt
3058 git fast-import <input
3061 test_expect_success
'U: validate file delete result' '
3062 cat >expect <<-EOF &&
3063 :100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D good/night.txt
3066 git diff-tree -M -r U^1 U >actual &&
3068 compare_diff_raw expect actual
3071 test_expect_success
'U: filedelete directory succeeds' '
3072 cat >input <<-INPUT_END &&
3074 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3083 git fast-import <input
3086 test_expect_success
'U: validate directory delete result' '
3087 cat >expect <<-EOF &&
3088 :100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D good/bye.txt
3091 git diff-tree -M -r U^1 U >actual &&
3093 compare_diff_raw expect actual
3096 test_expect_success
'U: filedelete root succeeds' '
3097 cat >input <<-INPUT_END &&
3099 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3108 git fast-import <input
3111 test_expect_success
'U: validate root delete result' '
3112 cat >expect <<-EOF &&
3113 :100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D hello.c
3116 git diff-tree -M -r U^1 U >actual &&
3118 compare_diff_raw expect actual