fast-import: implement unpack limit
[git.git] / t / t9300-fast-import.sh
blobe6a2b8a4d7939eb268eea799687c2b3b4b94e8ef
1 #!/bin/sh
3 # Copyright (c) 2007 Shawn Pearce
6 test_description='test git fast-import utility'
7 . ./test-lib.sh
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.
14 head_c () {
15 perl -e '
16 my $len = $ARGV[1];
17 while ($len > 0) {
18 my $s;
19 my $nread = sysread(STDIN, $s, $len);
20 die "cannot read: $!" unless defined($nread);
21 print $s;
22 $len -= $nread;
24 ' - "$1"
27 verify_packs () {
28 for p in .git/objects/pack/*.pack
30 git verify-pack "$@" "$p" || return
31 done
34 file2_data='file2
35 second line of EOF'
37 file3_data='EOF
38 in 3rd file
39 END'
41 file4_data=abcd
42 file4_len=4
44 file5_data='an inline file.
45 we should see it later.'
47 file6_data='#!/bin/sh
48 echo "$@"'
50 ###
51 ### series A
52 ###
54 test_expect_success 'empty stream succeeds' '
55 git config fastimport.unpackLimit 0 &&
56 git fast-import </dev/null
59 test_expect_success 'truncated stream complains' '
60 echo "tag foo" | test_must_fail git fast-import
63 test_expect_success 'A: create pack from stdin' '
64 test_tick &&
65 cat >input <<-INPUT_END &&
66 blob
67 mark :2
68 data <<EOF
69 $file2_data
70 EOF
72 blob
73 mark :3
74 data <<END
75 $file3_data
76 END
78 blob
79 mark :4
80 data $file4_len
81 $file4_data
82 commit refs/heads/master
83 mark :5
84 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
85 data <<COMMIT
86 initial
87 COMMIT
89 M 644 :2 file2
90 M 644 :3 file3
91 M 755 :4 file4
93 tag series-A
94 from :5
95 data <<EOF
96 An annotated tag without a tagger
97 EOF
99 tag series-A-blob
100 from :3
101 data <<EOF
102 An annotated tag that annotates a blob.
105 INPUT_END
106 git fast-import --export-marks=marks.out <input &&
107 git whatchanged master
110 test_expect_success 'A: verify pack' '
111 verify_packs
114 test_expect_success 'A: verify commit' '
115 cat >expect <<-EOF &&
116 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
117 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
119 initial
121 git cat-file commit master | sed 1d >actual &&
122 test_cmp expect actual
125 test_expect_success 'A: verify tree' '
126 cat >expect <<-EOF &&
127 100644 blob file2
128 100644 blob file3
129 100755 blob file4
131 git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
132 test_cmp expect actual
135 test_expect_success 'A: verify file2' '
136 echo "$file2_data" >expect &&
137 git cat-file blob master:file2 >actual &&
138 test_cmp expect actual
141 test_expect_success 'A: verify file3' '
142 echo "$file3_data" >expect &&
143 git cat-file blob master:file3 >actual &&
144 test_cmp expect actual
147 test_expect_success 'A: verify file4' '
148 printf "$file4_data" >expect &&
149 git cat-file blob master:file4 >actual &&
150 test_cmp expect actual
153 test_expect_success 'A: verify tag/series-A' '
154 cat >expect <<-EOF &&
155 object $(git rev-parse refs/heads/master)
156 type commit
157 tag series-A
159 An annotated tag without a tagger
161 git cat-file tag tags/series-A >actual &&
162 test_cmp expect actual
165 test_expect_success 'A: verify tag/series-A-blob' '
166 cat >expect <<-EOF &&
167 object $(git rev-parse refs/heads/master:file3)
168 type blob
169 tag series-A-blob
171 An annotated tag that annotates a blob.
173 git cat-file tag tags/series-A-blob >actual &&
174 test_cmp expect actual
177 test_expect_success 'A: verify marks output' '
178 cat >expect <<-EOF &&
179 :2 $(git rev-parse --verify master:file2)
180 :3 $(git rev-parse --verify master:file3)
181 :4 $(git rev-parse --verify master:file4)
182 :5 $(git rev-parse --verify master^0)
184 test_cmp expect marks.out
187 test_expect_success 'A: verify marks import' '
188 git fast-import \
189 --import-marks=marks.out \
190 --export-marks=marks.new \
191 </dev/null &&
192 test_cmp expect marks.new
195 test_expect_success 'A: tag blob by sha1' '
196 test_tick &&
197 new_blob=$(echo testing | git hash-object --stdin) &&
198 cat >input <<-INPUT_END &&
199 tag series-A-blob-2
200 from $(git rev-parse refs/heads/master:file3)
201 data <<EOF
202 Tag blob by sha1.
205 blob
206 mark :6
207 data <<EOF
208 testing
211 commit refs/heads/new_blob
212 committer <> 0 +0000
213 data 0
214 M 644 :6 new_blob
215 #pretend we got sha1 from fast-import
216 ls "new_blob"
218 tag series-A-blob-3
219 from $new_blob
220 data <<EOF
221 Tag new_blob.
223 INPUT_END
225 cat >expect <<-EOF &&
226 object $(git rev-parse refs/heads/master:file3)
227 type blob
228 tag series-A-blob-2
230 Tag blob by sha1.
231 object $new_blob
232 type blob
233 tag series-A-blob-3
235 Tag new_blob.
238 git fast-import <input &&
239 git cat-file tag tags/series-A-blob-2 >actual &&
240 git cat-file tag tags/series-A-blob-3 >>actual &&
241 test_cmp expect actual
244 test_expect_success 'A: verify marks import does not crash' '
245 test_tick &&
246 cat >input <<-INPUT_END &&
247 commit refs/heads/verify--import-marks
248 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
249 data <<COMMIT
250 recreate from :5
251 COMMIT
253 from :5
254 M 755 :2 copy-of-file2
256 INPUT_END
258 git fast-import --import-marks=marks.out <input &&
259 git whatchanged verify--import-marks
262 test_expect_success 'A: verify pack' '
263 verify_packs
266 test_expect_success 'A: verify diff' '
267 cat >expect <<-EOF &&
268 :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
270 git diff-tree -M -r master verify--import-marks >actual &&
271 compare_diff_raw expect actual &&
272 test $(git rev-parse --verify master:file2) \
273 = $(git rev-parse --verify verify--import-marks:copy-of-file2)
276 test_expect_success 'A: export marks with large values' '
277 test_tick &&
278 mt=$(git hash-object --stdin < /dev/null) &&
279 >input.blob &&
280 >marks.exp &&
281 >tree.exp &&
283 cat >input.commit <<-EOF &&
284 commit refs/heads/verify--dump-marks
285 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
286 data <<COMMIT
287 test the sparse array dumping routines with exponentially growing marks
288 COMMIT
291 i=0 l=4 m=6 n=7 &&
292 while test "$i" -lt 27
294 cat >>input.blob <<-EOF &&
295 blob
296 mark :$l
297 data 0
298 blob
299 mark :$m
300 data 0
301 blob
302 mark :$n
303 data 0
305 echo "M 100644 :$l l$i" >>input.commit &&
306 echo "M 100644 :$m m$i" >>input.commit &&
307 echo "M 100644 :$n n$i" >>input.commit &&
309 echo ":$l $mt" >>marks.exp &&
310 echo ":$m $mt" >>marks.exp &&
311 echo ":$n $mt" >>marks.exp &&
313 printf "100644 blob $mt\tl$i\n" >>tree.exp &&
314 printf "100644 blob $mt\tm$i\n" >>tree.exp &&
315 printf "100644 blob $mt\tn$i\n" >>tree.exp &&
317 l=$(($l + $l)) &&
318 m=$(($m + $m)) &&
319 n=$(($l + $n)) &&
321 i=$((1 + $i)) || return 1
322 done &&
324 sort tree.exp > tree.exp_s &&
326 cat input.blob input.commit | git fast-import --export-marks=marks.large &&
327 git ls-tree refs/heads/verify--dump-marks >tree.out &&
328 test_cmp tree.exp_s tree.out &&
329 test_cmp marks.exp marks.large
333 ### series B
336 test_expect_success 'B: fail on invalid blob sha1' '
337 test_tick &&
338 cat >input <<-INPUT_END &&
339 commit refs/heads/branch
340 mark :1
341 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
342 data <<COMMIT
343 corrupt
344 COMMIT
346 from refs/heads/master
347 M 755 0000000000000000000000000000000000000001 zero1
349 INPUT_END
351 test_when_finished "rm -f .git/objects/pack_* .git/objects/index_*" &&
352 test_must_fail git fast-import <input
355 test_expect_success 'B: accept branch name "TEMP_TAG"' '
356 cat >input <<-INPUT_END &&
357 commit TEMP_TAG
358 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
359 data <<COMMIT
360 tag base
361 COMMIT
363 from refs/heads/master
365 INPUT_END
367 test_when_finished "rm -f .git/TEMP_TAG
368 git gc
369 git prune" &&
370 git fast-import <input &&
371 test -f .git/TEMP_TAG &&
372 test $(git rev-parse master) = $(git rev-parse TEMP_TAG^)
375 test_expect_success 'B: accept empty committer' '
376 cat >input <<-INPUT_END &&
377 commit refs/heads/empty-committer-1
378 committer <> $GIT_COMMITTER_DATE
379 data <<COMMIT
380 empty commit
381 COMMIT
382 INPUT_END
384 test_when_finished "git update-ref -d refs/heads/empty-committer-1
385 git gc
386 git prune" &&
387 git fast-import <input &&
388 out=$(git fsck) &&
389 echo "$out" &&
390 test -z "$out"
393 test_expect_success 'B: accept and fixup committer with no name' '
394 cat >input <<-INPUT_END &&
395 commit refs/heads/empty-committer-2
396 committer <a@b.com> $GIT_COMMITTER_DATE
397 data <<COMMIT
398 empty commit
399 COMMIT
400 INPUT_END
402 test_when_finished "git update-ref -d refs/heads/empty-committer-2
403 git gc
404 git prune" &&
405 git fast-import <input &&
406 out=$(git fsck) &&
407 echo "$out" &&
408 test -z "$out"
411 test_expect_success 'B: fail on invalid committer (1)' '
412 cat >input <<-INPUT_END &&
413 commit refs/heads/invalid-committer
414 committer Name email> $GIT_COMMITTER_DATE
415 data <<COMMIT
416 empty commit
417 COMMIT
418 INPUT_END
420 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
421 test_must_fail git fast-import <input
424 test_expect_success 'B: fail on invalid committer (2)' '
425 cat >input <<-INPUT_END &&
426 commit refs/heads/invalid-committer
427 committer Name <e<mail> $GIT_COMMITTER_DATE
428 data <<COMMIT
429 empty commit
430 COMMIT
431 INPUT_END
433 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
434 test_must_fail git fast-import <input
437 test_expect_success 'B: fail on invalid committer (3)' '
438 cat >input <<-INPUT_END &&
439 commit refs/heads/invalid-committer
440 committer Name <email>> $GIT_COMMITTER_DATE
441 data <<COMMIT
442 empty commit
443 COMMIT
444 INPUT_END
446 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
447 test_must_fail git fast-import <input
450 test_expect_success 'B: fail on invalid committer (4)' '
451 cat >input <<-INPUT_END &&
452 commit refs/heads/invalid-committer
453 committer Name <email $GIT_COMMITTER_DATE
454 data <<COMMIT
455 empty commit
456 COMMIT
457 INPUT_END
459 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
460 test_must_fail git fast-import <input
463 test_expect_success 'B: fail on invalid committer (5)' '
464 cat >input <<-INPUT_END &&
465 commit refs/heads/invalid-committer
466 committer Name<email> $GIT_COMMITTER_DATE
467 data <<COMMIT
468 empty commit
469 COMMIT
470 INPUT_END
472 test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
473 test_must_fail git fast-import <input
477 ### series C
480 test_expect_success 'C: incremental import create pack from stdin' '
481 newf=$(echo hi newf | git hash-object -w --stdin) &&
482 oldf=$(git rev-parse --verify master:file2) &&
483 test_tick &&
484 cat >input <<-INPUT_END &&
485 commit refs/heads/branch
486 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
487 data <<COMMIT
488 second
489 COMMIT
491 from refs/heads/master
492 M 644 $oldf file2/oldf
493 M 755 $newf file2/newf
494 D file3
496 INPUT_END
498 git fast-import <input &&
499 git whatchanged branch
502 test_expect_success 'C: verify pack' '
503 verify_packs
506 test_expect_success 'C: validate reuse existing blob' '
507 test $newf = $(git rev-parse --verify branch:file2/newf) &&
508 test $oldf = $(git rev-parse --verify branch:file2/oldf)
511 test_expect_success 'C: verify commit' '
512 cat >expect <<-EOF &&
513 parent $(git rev-parse --verify master^0)
514 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
515 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
517 second
520 git cat-file commit branch | sed 1d >actual &&
521 test_cmp expect actual
524 test_expect_success 'C: validate rename result' '
525 cat >expect <<-EOF &&
526 :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
527 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
528 :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
530 git diff-tree -M -r master branch >actual &&
531 compare_diff_raw expect actual
535 ### series D
538 test_expect_success 'D: inline data in commit' '
539 test_tick &&
540 cat >input <<-INPUT_END &&
541 commit refs/heads/branch
542 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
543 data <<COMMIT
544 third
545 COMMIT
547 from refs/heads/branch^0
548 M 644 inline newdir/interesting
549 data <<EOF
550 $file5_data
553 M 755 inline newdir/exec.sh
554 data <<EOF
555 $file6_data
558 INPUT_END
560 git fast-import <input &&
561 git whatchanged branch
564 test_expect_success 'D: verify pack' '
565 verify_packs
568 test_expect_success 'D: validate new files added' '
569 cat >expect <<-EOF &&
570 :000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A newdir/exec.sh
571 :000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
573 git diff-tree -M -r branch^ branch >actual &&
574 compare_diff_raw expect actual
577 test_expect_success 'D: verify file5' '
578 echo "$file5_data" >expect &&
579 git cat-file blob branch:newdir/interesting >actual &&
580 test_cmp expect actual
583 test_expect_success 'D: verify file6' '
584 echo "$file6_data" >expect &&
585 git cat-file blob branch:newdir/exec.sh >actual &&
586 test_cmp expect actual
590 ### series E
593 test_expect_success 'E: rfc2822 date, --date-format=raw' '
594 cat >input <<-INPUT_END &&
595 commit refs/heads/branch
596 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
597 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
598 data <<COMMIT
599 RFC 2822 type date
600 COMMIT
602 from refs/heads/branch^0
604 INPUT_END
606 test_must_fail git fast-import --date-format=raw <input
608 test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '
609 git fast-import --date-format=rfc2822 <input
612 test_expect_success 'E: verify pack' '
613 verify_packs
616 test_expect_success 'E: verify commit' '
617 cat >expect <<-EOF &&
618 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
619 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
621 RFC 2822 type date
623 git cat-file commit branch | sed 1,2d >actual &&
624 test_cmp expect actual
628 ### series F
631 test_expect_success 'F: non-fast-forward update skips' '
632 old_branch=$(git rev-parse --verify branch^0) &&
633 test_tick &&
634 cat >input <<-INPUT_END &&
635 commit refs/heads/branch
636 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
637 data <<COMMIT
638 losing things already?
639 COMMIT
641 from refs/heads/branch~1
643 reset refs/heads/other
644 from refs/heads/branch
646 INPUT_END
648 test_must_fail git fast-import <input &&
649 # branch must remain unaffected
650 test $old_branch = $(git rev-parse --verify branch^0)
653 test_expect_success 'F: verify pack' '
654 verify_packs
657 test_expect_success 'F: verify other commit' '
658 cat >expect <<-EOF &&
659 tree $(git rev-parse branch~1^{tree})
660 parent $(git rev-parse branch~1)
661 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
662 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
664 losing things already?
666 git cat-file commit other >actual &&
667 test_cmp expect actual
671 ### series G
674 test_expect_success 'G: non-fast-forward update forced' '
675 old_branch=$(git rev-parse --verify branch^0) &&
676 test_tick &&
677 cat >input <<-INPUT_END &&
678 commit refs/heads/branch
679 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
680 data <<COMMIT
681 losing things already?
682 COMMIT
684 from refs/heads/branch~1
686 INPUT_END
687 git fast-import --force <input
690 test_expect_success 'G: verify pack' '
691 verify_packs
694 test_expect_success 'G: branch changed, but logged' '
695 test $old_branch != $(git rev-parse --verify branch^0) &&
696 test $old_branch = $(git rev-parse --verify branch@{1})
700 ### series H
703 test_expect_success 'H: deletall, add 1' '
704 test_tick &&
705 cat >input <<-INPUT_END &&
706 commit refs/heads/H
707 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
708 data <<COMMIT
709 third
710 COMMIT
712 from refs/heads/branch^0
713 M 644 inline i-will-die
714 data <<EOF
715 this file will never exist.
718 deleteall
719 M 644 inline h/e/l/lo
720 data <<EOF
721 $file5_data
724 INPUT_END
725 git fast-import <input &&
726 git whatchanged H
729 test_expect_success 'H: verify pack' '
730 verify_packs
733 test_expect_success 'H: validate old files removed, new files added' '
734 cat >expect <<-EOF &&
735 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
736 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
737 :100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
738 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
739 :100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
741 git diff-tree -M -r H^ H >actual &&
742 compare_diff_raw expect actual
745 test_expect_success 'H: verify file' '
746 echo "$file5_data" >expect &&
747 git cat-file blob H:h/e/l/lo >actual &&
748 test_cmp expect actual
752 ### series I
755 test_expect_success 'I: export-pack-edges' '
756 cat >input <<-INPUT_END &&
757 commit refs/heads/export-boundary
758 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
759 data <<COMMIT
760 we have a border. its only 40 characters wide.
761 COMMIT
763 from refs/heads/branch
765 INPUT_END
766 git fast-import --export-pack-edges=edges.list <input
769 test_expect_success 'I: verify edge list' '
770 cat >expect <<-EOF &&
771 .git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)
773 sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
774 test_cmp expect actual
778 ### series J
781 test_expect_success 'J: reset existing branch creates empty commit' '
782 cat >input <<-INPUT_END &&
783 commit refs/heads/J
784 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
785 data <<COMMIT
786 create J
787 COMMIT
789 from refs/heads/branch
791 reset refs/heads/J
793 commit refs/heads/J
794 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
795 data <<COMMIT
796 initialize J
797 COMMIT
799 INPUT_END
800 git fast-import <input
802 test_expect_success 'J: branch has 1 commit, empty tree' '
803 test 1 = $(git rev-list J | wc -l) &&
804 test 0 = $(git ls-tree J | wc -l)
807 test_expect_success 'J: tag must fail on empty branch' '
808 cat >input <<-INPUT_END &&
809 reset refs/heads/J2
811 tag wrong_tag
812 from refs/heads/J2
813 data <<EOF
814 Tag branch that was reset.
816 INPUT_END
817 test_must_fail git fast-import <input
821 ### series K
824 test_expect_success 'K: reinit branch with from' '
825 cat >input <<-INPUT_END &&
826 commit refs/heads/K
827 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
828 data <<COMMIT
829 create K
830 COMMIT
832 from refs/heads/branch
834 commit refs/heads/K
835 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
836 data <<COMMIT
837 redo K
838 COMMIT
840 from refs/heads/branch^1
842 INPUT_END
843 git fast-import <input
845 test_expect_success 'K: verify K^1 = branch^1' '
846 test $(git rev-parse --verify branch^1) \
847 = $(git rev-parse --verify K^1)
851 ### series L
854 test_expect_success 'L: verify internal tree sorting' '
855 cat >input <<-INPUT_END &&
856 blob
857 mark :1
858 data <<EOF
859 some data
862 blob
863 mark :2
864 data <<EOF
865 other data
868 commit refs/heads/L
869 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
870 data <<COMMIT
871 create L
872 COMMIT
874 M 644 :1 b.
875 M 644 :1 b/other
876 M 644 :1 ba
878 commit refs/heads/L
879 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
880 data <<COMMIT
881 update L
882 COMMIT
884 M 644 :2 b.
885 M 644 :2 b/other
886 M 644 :2 ba
887 INPUT_END
889 cat >expect <<-EXPECT_END &&
890 :100644 100644 4268632... 55d3a52... M b.
891 :040000 040000 0ae5cac... 443c768... M b
892 :100644 100644 4268632... 55d3a52... M ba
893 EXPECT_END
895 git fast-import <input &&
896 git diff-tree --abbrev --raw L^ L >output &&
897 test_cmp expect output
900 test_expect_success 'L: nested tree copy does not corrupt deltas' '
901 cat >input <<-INPUT_END &&
902 blob
903 mark :1
904 data <<EOF
905 the data
908 commit refs/heads/L2
909 committer C O Mitter <committer@example.com> 1112912473 -0700
910 data <<COMMIT
911 init L2
912 COMMIT
913 M 644 :1 a/b/c
914 M 644 :1 a/b/d
915 M 644 :1 a/e/f
917 commit refs/heads/L2
918 committer C O Mitter <committer@example.com> 1112912473 -0700
919 data <<COMMIT
920 update L2
921 COMMIT
922 C a g
923 C a/e g/b
924 M 644 :1 g/b/h
925 INPUT_END
927 cat >expect <<-\EOF &&
928 g/b/f
929 g/b/h
932 test_when_finished "git update-ref -d refs/heads/L2" &&
933 git fast-import <input &&
934 git ls-tree L2 g/b/ >tmp &&
935 cat tmp | cut -f 2 >actual &&
936 test_cmp expect actual &&
937 git fsck $(git rev-parse L2)
941 ### series M
944 test_expect_success 'M: rename file in same subdirectory' '
945 test_tick &&
946 cat >input <<-INPUT_END &&
947 commit refs/heads/M1
948 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
949 data <<COMMIT
950 file rename
951 COMMIT
953 from refs/heads/branch^0
954 R file2/newf file2/n.e.w.f
956 INPUT_END
958 cat >expect <<-EOF &&
959 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
961 git fast-import <input &&
962 git diff-tree -M -r M1^ M1 >actual &&
963 compare_diff_raw expect actual
966 test_expect_success 'M: rename file to new subdirectory' '
967 cat >input <<-INPUT_END &&
968 commit refs/heads/M2
969 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
970 data <<COMMIT
971 file rename
972 COMMIT
974 from refs/heads/branch^0
975 R file2/newf i/am/new/to/you
977 INPUT_END
979 cat >expect <<-EOF &&
980 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
982 git fast-import <input &&
983 git diff-tree -M -r M2^ M2 >actual &&
984 compare_diff_raw expect actual
987 test_expect_success 'M: rename subdirectory to new subdirectory' '
988 cat >input <<-INPUT_END &&
989 commit refs/heads/M3
990 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
991 data <<COMMIT
992 file rename
993 COMMIT
995 from refs/heads/M2^0
996 R i other/sub
998 INPUT_END
1000 cat >expect <<-EOF &&
1001 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
1003 git fast-import <input &&
1004 git diff-tree -M -r M3^ M3 >actual &&
1005 compare_diff_raw expect actual
1008 test_expect_success 'M: rename root to subdirectory' '
1009 cat >input <<-INPUT_END &&
1010 commit refs/heads/M4
1011 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1012 data <<COMMIT
1013 rename root
1014 COMMIT
1016 from refs/heads/M2^0
1017 R "" sub
1019 INPUT_END
1021 cat >expect <<-EOF &&
1022 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2/oldf sub/file2/oldf
1023 :100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 R100 file4 sub/file4
1024 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you sub/i/am/new/to/you
1025 :100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 R100 newdir/exec.sh sub/newdir/exec.sh
1026 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting sub/newdir/interesting
1028 git fast-import <input &&
1029 git diff-tree -M -r M4^ M4 >actual &&
1030 cat actual &&
1031 compare_diff_raw expect actual
1035 ### series N
1038 test_expect_success 'N: copy file in same subdirectory' '
1039 test_tick &&
1040 cat >input <<-INPUT_END &&
1041 commit refs/heads/N1
1042 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1043 data <<COMMIT
1044 file copy
1045 COMMIT
1047 from refs/heads/branch^0
1048 C file2/newf file2/n.e.w.f
1050 INPUT_END
1052 cat >expect <<-EOF &&
1053 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
1055 git fast-import <input &&
1056 git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
1057 compare_diff_raw expect actual
1060 test_expect_success 'N: copy then modify subdirectory' '
1061 cat >input <<-INPUT_END &&
1062 commit refs/heads/N2
1063 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1064 data <<COMMIT
1065 clean directory copy
1066 COMMIT
1068 from refs/heads/branch^0
1069 C file2 file3
1071 commit refs/heads/N2
1072 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1073 data <<COMMIT
1074 modify directory copy
1075 COMMIT
1077 M 644 inline file3/file5
1078 data <<EOF
1079 $file5_data
1082 INPUT_END
1084 cat >expect <<-EOF &&
1085 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
1086 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1087 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1089 git fast-import <input &&
1090 git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
1091 compare_diff_raw expect actual
1094 test_expect_success 'N: copy dirty subdirectory' '
1095 cat >input <<-INPUT_END &&
1096 commit refs/heads/N3
1097 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1098 data <<COMMIT
1099 dirty directory copy
1100 COMMIT
1102 from refs/heads/branch^0
1103 M 644 inline file2/file5
1104 data <<EOF
1105 $file5_data
1108 C file2 file3
1109 D file2/file5
1111 INPUT_END
1113 git fast-import <input &&
1114 test $(git rev-parse N2^{tree}) = $(git rev-parse N3^{tree})
1117 test_expect_success 'N: copy directory by id' '
1118 cat >expect <<-\EOF &&
1119 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1120 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1122 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1123 cat >input <<-INPUT_END &&
1124 commit refs/heads/N4
1125 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1126 data <<COMMIT
1127 copy by tree hash
1128 COMMIT
1130 from refs/heads/branch^0
1131 M 040000 $subdir file3
1132 INPUT_END
1133 git fast-import <input &&
1134 git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
1135 compare_diff_raw expect actual
1138 test_expect_success PIPE 'N: read and copy directory' '
1139 cat >expect <<-\EOF &&
1140 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1141 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1143 git update-ref -d refs/heads/N4 &&
1144 rm -f backflow &&
1145 mkfifo backflow &&
1147 exec <backflow &&
1148 cat <<-EOF &&
1149 commit refs/heads/N4
1150 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1151 data <<COMMIT
1152 copy by tree hash, part 2
1153 COMMIT
1155 from refs/heads/branch^0
1156 ls "file2"
1158 read mode type tree filename &&
1159 echo "M 040000 $tree file3"
1161 git fast-import --cat-blob-fd=3 3>backflow &&
1162 git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
1163 compare_diff_raw expect actual
1166 test_expect_success PIPE 'N: empty directory reads as missing' '
1167 cat <<-\EOF >expect &&
1168 OBJNAME
1169 :000000 100644 OBJNAME OBJNAME A unrelated
1171 echo "missing src" >expect.response &&
1172 git update-ref -d refs/heads/read-empty &&
1173 rm -f backflow &&
1174 mkfifo backflow &&
1176 exec <backflow &&
1177 cat <<-EOF &&
1178 commit refs/heads/read-empty
1179 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1180 data <<COMMIT
1181 read "empty" (missing) directory
1182 COMMIT
1184 M 100644 inline src/greeting
1185 data <<BLOB
1186 hello
1187 BLOB
1188 C src/greeting dst1/non-greeting
1189 C src/greeting unrelated
1190 # leave behind "empty" src directory
1191 D src/greeting
1192 ls "src"
1194 read -r line &&
1195 printf "%s\n" "$line" >response &&
1196 cat <<-\EOF
1197 D dst1
1198 D dst2
1201 git fast-import --cat-blob-fd=3 3>backflow &&
1202 test_cmp expect.response response &&
1203 git rev-list read-empty |
1204 git diff-tree -r --root --stdin |
1205 sed "s/$_x40/OBJNAME/g" >actual &&
1206 test_cmp expect actual
1209 test_expect_success 'N: copy root directory by tree hash' '
1210 cat >expect <<-\EOF &&
1211 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file3/newf
1212 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file3/oldf
1214 root=$(git rev-parse refs/heads/branch^0^{tree}) &&
1215 cat >input <<-INPUT_END &&
1216 commit refs/heads/N6
1217 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1218 data <<COMMIT
1219 copy root directory by tree hash
1220 COMMIT
1222 from refs/heads/branch^0
1223 M 040000 $root ""
1224 INPUT_END
1225 git fast-import <input &&
1226 git diff-tree -C --find-copies-harder -r N4 N6 >actual &&
1227 compare_diff_raw expect actual
1230 test_expect_success 'N: copy root by path' '
1231 cat >expect <<-\EOF &&
1232 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf oldroot/file2/newf
1233 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf oldroot/file2/oldf
1234 :100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 C100 file4 oldroot/file4
1235 :100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 C100 newdir/exec.sh oldroot/newdir/exec.sh
1236 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting oldroot/newdir/interesting
1238 cat >input <<-INPUT_END &&
1239 commit refs/heads/N-copy-root-path
1240 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1241 data <<COMMIT
1242 copy root directory by (empty) path
1243 COMMIT
1245 from refs/heads/branch^0
1246 C "" oldroot
1247 INPUT_END
1248 git fast-import <input &&
1249 git diff-tree -C --find-copies-harder -r branch N-copy-root-path >actual &&
1250 compare_diff_raw expect actual
1253 test_expect_success 'N: delete directory by copying' '
1254 cat >expect <<-\EOF &&
1255 OBJID
1256 :100644 000000 OBJID OBJID D foo/bar/qux
1257 OBJID
1258 :000000 100644 OBJID OBJID A foo/bar/baz
1259 :000000 100644 OBJID OBJID A foo/bar/qux
1261 empty_tree=$(git mktree </dev/null) &&
1262 cat >input <<-INPUT_END &&
1263 commit refs/heads/N-delete
1264 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1265 data <<COMMIT
1266 collect data to be deleted
1267 COMMIT
1269 deleteall
1270 M 100644 inline foo/bar/baz
1271 data <<DATA_END
1272 hello
1273 DATA_END
1274 C "foo/bar/baz" "foo/bar/qux"
1275 C "foo/bar/baz" "foo/bar/quux/1"
1276 C "foo/bar/baz" "foo/bar/quuux"
1277 M 040000 $empty_tree foo/bar/quux
1278 M 040000 $empty_tree foo/bar/quuux
1280 commit refs/heads/N-delete
1281 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1282 data <<COMMIT
1283 delete subdirectory
1284 COMMIT
1286 M 040000 $empty_tree foo/bar/qux
1287 INPUT_END
1288 git fast-import <input &&
1289 git rev-list N-delete |
1290 git diff-tree -r --stdin --root --always |
1291 sed -e "s/$_x40/OBJID/g" >actual &&
1292 test_cmp expect actual
1295 test_expect_success 'N: modify copied tree' '
1296 cat >expect <<-\EOF &&
1297 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
1298 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1299 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1301 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1302 cat >input <<-INPUT_END &&
1303 commit refs/heads/N5
1304 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1305 data <<COMMIT
1306 copy by tree hash
1307 COMMIT
1309 from refs/heads/branch^0
1310 M 040000 $subdir file3
1312 commit refs/heads/N5
1313 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1314 data <<COMMIT
1315 modify directory copy
1316 COMMIT
1318 M 644 inline file3/file5
1319 data <<EOF
1320 $file5_data
1322 INPUT_END
1323 git fast-import <input &&
1324 git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&
1325 compare_diff_raw expect actual
1328 test_expect_success 'N: reject foo/ syntax' '
1329 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
1330 test_must_fail git fast-import <<-INPUT_END
1331 commit refs/heads/N5B
1332 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1333 data <<COMMIT
1334 copy with invalid syntax
1335 COMMIT
1337 from refs/heads/branch^0
1338 M 040000 $subdir file3/
1339 INPUT_END
1342 test_expect_success 'N: reject foo/ syntax in copy source' '
1343 test_must_fail git fast-import <<-INPUT_END
1344 commit refs/heads/N5C
1345 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1346 data <<COMMIT
1347 copy with invalid syntax
1348 COMMIT
1350 from refs/heads/branch^0
1351 C file2/ file3
1352 INPUT_END
1355 test_expect_success 'N: reject foo/ syntax in rename source' '
1356 test_must_fail git fast-import <<-INPUT_END
1357 commit refs/heads/N5D
1358 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1359 data <<COMMIT
1360 rename with invalid syntax
1361 COMMIT
1363 from refs/heads/branch^0
1364 R file2/ file3
1365 INPUT_END
1368 test_expect_success 'N: reject foo/ syntax in ls argument' '
1369 test_must_fail git fast-import <<-INPUT_END
1370 commit refs/heads/N5E
1371 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1372 data <<COMMIT
1373 copy with invalid syntax
1374 COMMIT
1376 from refs/heads/branch^0
1377 ls "file2/"
1378 INPUT_END
1381 test_expect_success 'N: copy to root by id and modify' '
1382 echo "hello, world" >expect.foo &&
1383 echo hello >expect.bar &&
1384 git fast-import <<-SETUP_END &&
1385 commit refs/heads/N7
1386 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1387 data <<COMMIT
1388 hello, tree
1389 COMMIT
1391 deleteall
1392 M 644 inline foo/bar
1393 data <<EOF
1394 hello
1396 SETUP_END
1398 tree=$(git rev-parse --verify N7:) &&
1399 git fast-import <<-INPUT_END &&
1400 commit refs/heads/N8
1401 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1402 data <<COMMIT
1403 copy to root by id and modify
1404 COMMIT
1406 M 040000 $tree ""
1407 M 644 inline foo/foo
1408 data <<EOF
1409 hello, world
1411 INPUT_END
1412 git show N8:foo/foo >actual.foo &&
1413 git show N8:foo/bar >actual.bar &&
1414 test_cmp expect.foo actual.foo &&
1415 test_cmp expect.bar actual.bar
1418 test_expect_success 'N: extract subtree' '
1419 branch=$(git rev-parse --verify refs/heads/branch^{tree}) &&
1420 cat >input <<-INPUT_END &&
1421 commit refs/heads/N9
1422 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1423 data <<COMMIT
1424 extract subtree branch:newdir
1425 COMMIT
1427 M 040000 $branch ""
1428 C "newdir" ""
1429 INPUT_END
1430 git fast-import <input &&
1431 git diff --exit-code branch:newdir N9
1434 test_expect_success 'N: modify subtree, extract it, and modify again' '
1435 echo hello >expect.baz &&
1436 echo hello, world >expect.qux &&
1437 git fast-import <<-SETUP_END &&
1438 commit refs/heads/N10
1439 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1440 data <<COMMIT
1441 hello, tree
1442 COMMIT
1444 deleteall
1445 M 644 inline foo/bar/baz
1446 data <<EOF
1447 hello
1449 SETUP_END
1451 tree=$(git rev-parse --verify N10:) &&
1452 git fast-import <<-INPUT_END &&
1453 commit refs/heads/N11
1454 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1455 data <<COMMIT
1456 copy to root by id and modify
1457 COMMIT
1459 M 040000 $tree ""
1460 M 100644 inline foo/bar/qux
1461 data <<EOF
1462 hello, world
1464 R "foo" ""
1465 C "bar/qux" "bar/quux"
1466 INPUT_END
1467 git show N11:bar/baz >actual.baz &&
1468 git show N11:bar/qux >actual.qux &&
1469 git show N11:bar/quux >actual.quux &&
1470 test_cmp expect.baz actual.baz &&
1471 test_cmp expect.qux actual.qux &&
1472 test_cmp expect.qux actual.quux'
1475 ### series O
1478 test_expect_success 'O: comments are all skipped' '
1479 cat >input <<-INPUT_END &&
1480 #we will
1481 commit refs/heads/O1
1482 # -- ignore all of this text
1483 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1484 # $GIT_COMMITTER_NAME has inserted here for his benefit.
1485 data <<COMMIT
1486 dirty directory copy
1487 COMMIT
1489 # do not forget the import blank line!
1491 # yes, we started from our usual base of branch^0.
1492 # i like branch^0.
1493 from refs/heads/branch^0
1494 # and we need to reuse file2/file5 from N3 above.
1495 M 644 inline file2/file5
1496 # otherwise the tree will be different
1497 data <<EOF
1498 $file5_data
1501 # do not forget to copy file2 to file3
1502 C file2 file3
1504 # or to delete file5 from file2.
1505 D file2/file5
1506 # are we done yet?
1508 INPUT_END
1510 git fast-import <input &&
1511 test $(git rev-parse N3) = $(git rev-parse O1)
1514 test_expect_success 'O: blank lines not necessary after data commands' '
1515 cat >input <<-INPUT_END &&
1516 commit refs/heads/O2
1517 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1518 data <<COMMIT
1519 dirty directory copy
1520 COMMIT
1521 from refs/heads/branch^0
1522 M 644 inline file2/file5
1523 data <<EOF
1524 $file5_data
1526 C file2 file3
1527 D file2/file5
1529 INPUT_END
1531 git fast-import <input &&
1532 test $(git rev-parse N3) = $(git rev-parse O2)
1535 test_expect_success 'O: repack before next test' '
1536 git repack -a -d
1539 test_expect_success 'O: blank lines not necessary after other commands' '
1540 cat >input <<-INPUT_END &&
1541 commit refs/heads/O3
1542 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1543 data <<COMMIT
1544 zstring
1545 COMMIT
1546 commit refs/heads/O3
1547 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1548 data <<COMMIT
1550 COMMIT
1551 checkpoint
1552 commit refs/heads/O3
1553 mark :5
1554 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1555 data <<COMMIT
1556 zempty
1557 COMMIT
1558 checkpoint
1559 commit refs/heads/O3
1560 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1561 data <<COMMIT
1562 zcommits
1563 COMMIT
1564 reset refs/tags/O3-2nd
1565 from :5
1566 reset refs/tags/O3-3rd
1567 from :5
1568 INPUT_END
1570 cat >expect <<-INPUT_END &&
1571 string
1573 empty
1574 commits
1575 INPUT_END
1577 git fast-import <input &&
1578 test 8 = $(find .git/objects/pack -type f | wc -l) &&
1579 test $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&
1580 git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
1581 test_cmp expect actual
1584 test_expect_success 'O: progress outputs as requested by input' '
1585 cat >input <<-INPUT_END &&
1586 commit refs/heads/O4
1587 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1588 data <<COMMIT
1589 zstring
1590 COMMIT
1591 commit refs/heads/O4
1592 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1593 data <<COMMIT
1595 COMMIT
1596 progress Two commits down, 2 to go!
1597 commit refs/heads/O4
1598 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1599 data <<COMMIT
1600 zempty
1601 COMMIT
1602 progress Three commits down, 1 to go!
1603 commit refs/heads/O4
1604 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1605 data <<COMMIT
1606 zcommits
1607 COMMIT
1608 progress done!
1609 INPUT_END
1610 git fast-import <input >actual &&
1611 grep "progress " <input >expect &&
1612 test_cmp expect actual
1616 ### series P (gitlinks)
1619 test_expect_success 'P: superproject & submodule mix' '
1620 cat >input <<-INPUT_END &&
1621 blob
1622 mark :1
1623 data 10
1624 test file
1626 reset refs/heads/sub
1627 commit refs/heads/sub
1628 mark :2
1629 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1630 data 12
1631 sub_initial
1632 M 100644 :1 file
1634 blob
1635 mark :3
1636 data <<DATAEND
1637 [submodule "sub"]
1638 path = sub
1639 url = "$(pwd)/sub"
1640 DATAEND
1642 commit refs/heads/subuse1
1643 mark :4
1644 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1645 data 8
1646 initial
1647 from refs/heads/master
1648 M 100644 :3 .gitmodules
1649 M 160000 :2 sub
1651 blob
1652 mark :5
1653 data 20
1654 test file
1655 more data
1657 commit refs/heads/sub
1658 mark :6
1659 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1660 data 11
1661 sub_second
1662 from :2
1663 M 100644 :5 file
1665 commit refs/heads/subuse1
1666 mark :7
1667 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1668 data 7
1669 second
1670 from :4
1671 M 160000 :6 sub
1673 INPUT_END
1675 git fast-import <input &&
1676 git checkout subuse1 &&
1677 rm -rf sub &&
1678 mkdir sub &&
1680 cd sub &&
1681 git init &&
1682 git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
1683 git checkout master
1684 ) &&
1685 git submodule init &&
1686 git submodule update
1689 test_expect_success 'P: verbatim SHA gitlinks' '
1690 SUBLAST=$(git rev-parse --verify sub) &&
1691 SUBPREV=$(git rev-parse --verify sub^) &&
1693 cat >input <<-INPUT_END &&
1694 blob
1695 mark :1
1696 data <<DATAEND
1697 [submodule "sub"]
1698 path = sub
1699 url = "$(pwd)/sub"
1700 DATAEND
1702 commit refs/heads/subuse2
1703 mark :2
1704 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1705 data 8
1706 initial
1707 from refs/heads/master
1708 M 100644 :1 .gitmodules
1709 M 160000 $SUBPREV sub
1711 commit refs/heads/subuse2
1712 mark :3
1713 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1714 data 7
1715 second
1716 from :2
1717 M 160000 $SUBLAST sub
1719 INPUT_END
1721 git branch -D sub &&
1722 git gc &&
1723 git prune &&
1724 git fast-import <input &&
1725 test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
1728 test_expect_success 'P: fail on inline gitlink' '
1729 test_tick &&
1730 cat >input <<-INPUT_END &&
1731 commit refs/heads/subuse3
1732 mark :1
1733 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1734 data <<COMMIT
1735 corrupt
1736 COMMIT
1738 from refs/heads/subuse2
1739 M 160000 inline sub
1740 data <<DATA
1741 $SUBPREV
1742 DATA
1744 INPUT_END
1746 test_must_fail git fast-import <input
1749 test_expect_success 'P: fail on blob mark in gitlink' '
1750 test_tick &&
1751 cat >input <<-INPUT_END &&
1752 blob
1753 mark :1
1754 data <<DATA
1755 $SUBPREV
1756 DATA
1758 commit refs/heads/subuse3
1759 mark :2
1760 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1761 data <<COMMIT
1762 corrupt
1763 COMMIT
1765 from refs/heads/subuse2
1766 M 160000 :1 sub
1768 INPUT_END
1770 test_must_fail git fast-import <input
1774 ### series Q (notes)
1777 test_expect_success 'Q: commit notes' '
1778 note1_data="The first note for the first commit" &&
1779 note2_data="The first note for the second commit" &&
1780 note3_data="The first note for the third commit" &&
1781 note1b_data="The second note for the first commit" &&
1782 note1c_data="The third note for the first commit" &&
1783 note2b_data="The second note for the second commit" &&
1785 test_tick &&
1786 cat >input <<-INPUT_END &&
1787 blob
1788 mark :2
1789 data <<EOF
1790 $file2_data
1793 commit refs/heads/notes-test
1794 mark :3
1795 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1796 data <<COMMIT
1797 first (:3)
1798 COMMIT
1800 M 644 :2 file2
1802 blob
1803 mark :4
1804 data $file4_len
1805 $file4_data
1806 commit refs/heads/notes-test
1807 mark :5
1808 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1809 data <<COMMIT
1810 second (:5)
1811 COMMIT
1813 M 644 :4 file4
1815 commit refs/heads/notes-test
1816 mark :6
1817 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1818 data <<COMMIT
1819 third (:6)
1820 COMMIT
1822 M 644 inline file5
1823 data <<EOF
1824 $file5_data
1827 M 755 inline file6
1828 data <<EOF
1829 $file6_data
1832 blob
1833 mark :7
1834 data <<EOF
1835 $note1_data
1838 blob
1839 mark :8
1840 data <<EOF
1841 $note2_data
1844 commit refs/notes/foobar
1845 mark :9
1846 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1847 data <<COMMIT
1848 notes (:9)
1849 COMMIT
1851 N :7 :3
1852 N :8 :5
1853 N inline :6
1854 data <<EOF
1855 $note3_data
1858 commit refs/notes/foobar
1859 mark :10
1860 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1861 data <<COMMIT
1862 notes (:10)
1863 COMMIT
1865 N inline :3
1866 data <<EOF
1867 $note1b_data
1870 commit refs/notes/foobar2
1871 mark :11
1872 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1873 data <<COMMIT
1874 notes (:11)
1875 COMMIT
1877 N inline :3
1878 data <<EOF
1879 $note1c_data
1882 commit refs/notes/foobar
1883 mark :12
1884 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1885 data <<COMMIT
1886 notes (:12)
1887 COMMIT
1889 deleteall
1890 N inline :5
1891 data <<EOF
1892 $note2b_data
1895 INPUT_END
1897 git fast-import <input &&
1898 git whatchanged notes-test
1901 test_expect_success 'Q: verify pack' '
1902 verify_packs
1905 test_expect_success 'Q: verify first commit' '
1906 commit1=$(git rev-parse notes-test~2) &&
1907 commit2=$(git rev-parse notes-test^) &&
1908 commit3=$(git rev-parse notes-test) &&
1910 cat >expect <<-EOF &&
1911 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1912 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1914 first (:3)
1916 git cat-file commit notes-test~2 | sed 1d >actual &&
1917 test_cmp expect actual
1920 test_expect_success 'Q: verify second commit' '
1921 cat >expect <<-EOF &&
1922 parent $commit1
1923 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1924 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1926 second (:5)
1928 git cat-file commit notes-test^ | sed 1d >actual &&
1929 test_cmp expect actual
1932 test_expect_success 'Q: verify third commit' '
1933 cat >expect <<-EOF &&
1934 parent $commit2
1935 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1936 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1938 third (:6)
1940 git cat-file commit notes-test | sed 1d >actual &&
1941 test_cmp expect actual
1944 test_expect_success 'Q: verify first notes commit' '
1945 cat >expect <<-EOF &&
1946 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1947 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1949 notes (:9)
1951 git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&
1952 test_cmp expect actual
1955 test_expect_success 'Q: verify first notes tree' '
1956 cat >expect.unsorted <<-EOF &&
1957 100644 blob $commit1
1958 100644 blob $commit2
1959 100644 blob $commit3
1961 cat expect.unsorted | sort >expect &&
1962 git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1963 test_cmp expect actual
1966 test_expect_success 'Q: verify first note for first commit' '
1967 echo "$note1_data" >expect &&
1968 git cat-file blob refs/notes/foobar~2:$commit1 >actual &&
1969 test_cmp expect actual
1972 test_expect_success 'Q: verify first note for second commit' '
1973 echo "$note2_data" >expect &&
1974 git cat-file blob refs/notes/foobar~2:$commit2 >actual &&
1975 test_cmp expect actual
1978 test_expect_success 'Q: verify first note for third commit' '
1979 echo "$note3_data" >expect &&
1980 git cat-file blob refs/notes/foobar~2:$commit3 >actual &&
1981 test_cmp expect actual
1984 test_expect_success 'Q: verify second notes commit' '
1985 cat >expect <<-EOF &&
1986 parent $(git rev-parse --verify refs/notes/foobar~2)
1987 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1988 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1990 notes (:10)
1992 git cat-file commit refs/notes/foobar^ | sed 1d >actual &&
1993 test_cmp expect actual
1996 test_expect_success 'Q: verify second notes tree' '
1997 cat >expect.unsorted <<-EOF &&
1998 100644 blob $commit1
1999 100644 blob $commit2
2000 100644 blob $commit3
2002 cat expect.unsorted | sort >expect &&
2003 git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2004 test_cmp expect actual
2007 test_expect_success 'Q: verify second note for first commit' '
2008 echo "$note1b_data" >expect &&
2009 git cat-file blob refs/notes/foobar^:$commit1 >actual &&
2010 test_cmp expect actual
2013 test_expect_success 'Q: verify first note for second commit' '
2014 echo "$note2_data" >expect &&
2015 git cat-file blob refs/notes/foobar^:$commit2 >actual &&
2016 test_cmp expect actual
2019 test_expect_success 'Q: verify first note for third commit' '
2020 echo "$note3_data" >expect &&
2021 git cat-file blob refs/notes/foobar^:$commit3 >actual &&
2022 test_cmp expect actual
2025 test_expect_success 'Q: verify third notes commit' '
2026 cat >expect <<-EOF &&
2027 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2028 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2030 notes (:11)
2032 git cat-file commit refs/notes/foobar2 | sed 1d >actual &&
2033 test_cmp expect actual
2036 test_expect_success 'Q: verify third notes tree' '
2037 cat >expect.unsorted <<-EOF &&
2038 100644 blob $commit1
2040 cat expect.unsorted | sort >expect &&
2041 git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2042 test_cmp expect actual
2045 test_expect_success 'Q: verify third note for first commit' '
2046 echo "$note1c_data" >expect &&
2047 git cat-file blob refs/notes/foobar2:$commit1 >actual &&
2048 test_cmp expect actual
2051 test_expect_success 'Q: verify fourth notes commit' '
2052 cat >expect <<-EOF &&
2053 parent $(git rev-parse --verify refs/notes/foobar^)
2054 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2055 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2057 notes (:12)
2059 git cat-file commit refs/notes/foobar | sed 1d >actual &&
2060 test_cmp expect actual
2063 test_expect_success 'Q: verify fourth notes tree' '
2064 cat >expect.unsorted <<-EOF &&
2065 100644 blob $commit2
2067 cat expect.unsorted | sort >expect &&
2068 git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2069 test_cmp expect actual
2072 test_expect_success 'Q: verify second note for second commit' '
2073 echo "$note2b_data" >expect &&
2074 git cat-file blob refs/notes/foobar:$commit2 >actual &&
2075 test_cmp expect actual
2078 test_expect_success 'Q: deny note on empty branch' '
2079 cat >input <<-EOF &&
2080 reset refs/heads/Q0
2082 commit refs/heads/note-Q0
2083 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2084 data <<COMMIT
2085 Note for an empty branch.
2086 COMMIT
2088 N inline refs/heads/Q0
2089 data <<NOTE
2090 some note
2091 NOTE
2093 test_must_fail git fast-import <input
2096 ### series R (feature and option)
2099 test_expect_success 'R: abort on unsupported feature' '
2100 cat >input <<-EOF &&
2101 feature no-such-feature-exists
2104 test_must_fail git fast-import <input
2107 test_expect_success 'R: supported feature is accepted' '
2108 cat >input <<-EOF &&
2109 feature date-format=now
2112 git fast-import <input
2115 test_expect_success 'R: abort on receiving feature after data command' '
2116 cat >input <<-EOF &&
2117 blob
2118 data 3
2120 feature date-format=now
2123 test_must_fail git fast-import <input
2126 test_expect_success 'R: only one import-marks feature allowed per stream' '
2127 cat >input <<-EOF &&
2128 feature import-marks=git.marks
2129 feature import-marks=git2.marks
2132 test_must_fail git fast-import <input
2135 test_expect_success 'R: export-marks feature results in a marks file being created' '
2136 cat >input <<-EOF &&
2137 feature export-marks=git.marks
2138 blob
2139 mark :1
2140 data 3
2145 cat input | git fast-import &&
2146 grep :1 git.marks
2149 test_expect_success 'R: export-marks options can be overridden by commandline options' '
2150 cat input | git fast-import --export-marks=other.marks &&
2151 grep :1 other.marks
2154 test_expect_success 'R: catch typo in marks file name' '
2155 test_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&
2156 echo "feature import-marks=nonexistent.marks" |
2157 test_must_fail git fast-import
2160 test_expect_success 'R: import and output marks can be the same file' '
2161 rm -f io.marks &&
2162 blob=$(echo hi | git hash-object --stdin) &&
2163 cat >expect <<-EOF &&
2164 :1 $blob
2165 :2 $blob
2167 git fast-import --export-marks=io.marks <<-\EOF &&
2168 blob
2169 mark :1
2170 data 3
2174 git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF &&
2175 blob
2176 mark :2
2177 data 3
2181 test_cmp expect io.marks
2184 test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '
2185 rm -f io.marks &&
2186 test_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF
2187 blob
2188 mark :1
2189 data 3
2195 test_expect_success 'R: --import-marks-if-exists' '
2196 rm -f io.marks &&
2197 blob=$(echo hi | git hash-object --stdin) &&
2198 echo ":1 $blob" >expect &&
2199 git fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\EOF &&
2200 blob
2201 mark :1
2202 data 3
2206 test_cmp expect io.marks
2209 test_expect_success 'R: feature import-marks-if-exists' '
2210 rm -f io.marks &&
2211 >expect &&
2213 git fast-import --export-marks=io.marks <<-\EOF &&
2214 feature import-marks-if-exists=not_io.marks
2216 test_cmp expect io.marks &&
2218 blob=$(echo hi | git hash-object --stdin) &&
2220 echo ":1 $blob" >io.marks &&
2221 echo ":1 $blob" >expect &&
2222 echo ":2 $blob" >>expect &&
2224 git fast-import --export-marks=io.marks <<-\EOF &&
2225 feature import-marks-if-exists=io.marks
2226 blob
2227 mark :2
2228 data 3
2232 test_cmp expect io.marks &&
2234 echo ":3 $blob" >>expect &&
2236 git fast-import --import-marks=io.marks \
2237 --export-marks=io.marks <<-\EOF &&
2238 feature import-marks-if-exists=not_io.marks
2239 blob
2240 mark :3
2241 data 3
2245 test_cmp expect io.marks &&
2247 >expect &&
2249 git fast-import --import-marks-if-exists=not_io.marks \
2250 --export-marks=io.marks <<-\EOF &&
2251 feature import-marks-if-exists=io.marks
2253 test_cmp expect io.marks
2256 test_expect_success 'R: import to output marks works without any content' '
2257 cat >input <<-EOF &&
2258 feature import-marks=marks.out
2259 feature export-marks=marks.new
2262 cat input | git fast-import &&
2263 test_cmp marks.out marks.new
2266 test_expect_success 'R: import marks prefers commandline marks file over the stream' '
2267 cat >input <<-EOF &&
2268 feature import-marks=nonexistent.marks
2269 feature export-marks=marks.new
2272 cat input | git fast-import --import-marks=marks.out &&
2273 test_cmp marks.out marks.new
2277 test_expect_success 'R: multiple --import-marks= should be honoured' '
2278 cat >input <<-EOF &&
2279 feature import-marks=nonexistent.marks
2280 feature export-marks=combined.marks
2283 head -n2 marks.out > one.marks &&
2284 tail -n +3 marks.out > two.marks &&
2285 git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
2286 test_cmp marks.out combined.marks
2289 test_expect_success 'R: feature relative-marks should be honoured' '
2290 cat >input <<-EOF &&
2291 feature relative-marks
2292 feature import-marks=relative.in
2293 feature export-marks=relative.out
2296 mkdir -p .git/info/fast-import/ &&
2297 cp marks.new .git/info/fast-import/relative.in &&
2298 git fast-import <input &&
2299 test_cmp marks.new .git/info/fast-import/relative.out
2302 test_expect_success 'R: feature no-relative-marks should be honoured' '
2303 cat >input <<-EOF &&
2304 feature relative-marks
2305 feature import-marks=relative.in
2306 feature no-relative-marks
2307 feature export-marks=non-relative.out
2310 git fast-import <input &&
2311 test_cmp marks.new non-relative.out
2314 test_expect_success 'R: feature ls supported' '
2315 echo "feature ls" |
2316 git fast-import
2319 test_expect_success 'R: feature cat-blob supported' '
2320 echo "feature cat-blob" |
2321 git fast-import
2324 test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '
2325 test_must_fail git fast-import --cat-blob-fd=-1 </dev/null
2328 test_expect_success !MINGW 'R: print old blob' '
2329 blob=$(echo "yes it can" | git hash-object -w --stdin) &&
2330 cat >expect <<-EOF &&
2331 ${blob} blob 11
2332 yes it can
2335 echo "cat-blob $blob" |
2336 git fast-import --cat-blob-fd=6 6>actual &&
2337 test_cmp expect actual
2340 test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '
2341 echo hello >greeting &&
2342 blob=$(git hash-object -w greeting) &&
2343 cat >expect <<-EOF &&
2344 ${blob} blob 6
2345 hello
2348 git fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&
2349 cat-blob $blob
2351 test_cmp expect actual.3 &&
2352 test_must_be_empty actual.1 &&
2353 git fast-import 3>actual.3 >actual.1 <<-EOF &&
2354 option cat-blob-fd=3
2355 cat-blob $blob
2357 test_must_be_empty actual.3 &&
2358 test_cmp expect actual.1
2361 test_expect_success !MINGW 'R: print mark for new blob' '
2362 echo "effluentish" | git hash-object --stdin >expect &&
2363 git fast-import --cat-blob-fd=6 6>actual <<-\EOF &&
2364 blob
2365 mark :1
2366 data <<BLOB_END
2367 effluentish
2368 BLOB_END
2369 get-mark :1
2371 test_cmp expect actual
2374 test_expect_success !MINGW 'R: print new blob' '
2375 blob=$(echo "yep yep yep" | git hash-object --stdin) &&
2376 cat >expect <<-EOF &&
2377 ${blob} blob 12
2378 yep yep yep
2381 git fast-import --cat-blob-fd=6 6>actual <<-\EOF &&
2382 blob
2383 mark :1
2384 data <<BLOB_END
2385 yep yep yep
2386 BLOB_END
2387 cat-blob :1
2389 test_cmp expect actual
2392 test_expect_success !MINGW 'R: print new blob by sha1' '
2393 blob=$(echo "a new blob named by sha1" | git hash-object --stdin) &&
2394 cat >expect <<-EOF &&
2395 ${blob} blob 25
2396 a new blob named by sha1
2399 git fast-import --cat-blob-fd=6 6>actual <<-EOF &&
2400 blob
2401 data <<BLOB_END
2402 a new blob named by sha1
2403 BLOB_END
2404 cat-blob $blob
2406 test_cmp expect actual
2409 test_expect_success 'setup: big file' '
2411 echo "the quick brown fox jumps over the lazy dog" >big &&
2412 for i in 1 2 3
2414 cat big big big big >bigger &&
2415 cat bigger bigger bigger bigger >big ||
2416 exit
2417 done
2421 test_expect_success 'R: print two blobs to stdout' '
2422 blob1=$(git hash-object big) &&
2423 blob1_len=$(wc -c <big) &&
2424 blob2=$(echo hello | git hash-object --stdin) &&
2426 echo ${blob1} blob $blob1_len &&
2427 cat big &&
2428 cat <<-EOF
2430 ${blob2} blob 6
2431 hello
2434 } >expect &&
2436 cat <<-\END_PART1 &&
2437 blob
2438 mark :1
2439 data <<data_end
2440 END_PART1
2441 cat big &&
2442 cat <<-\EOF
2443 data_end
2444 blob
2445 mark :2
2446 data <<data_end
2447 hello
2448 data_end
2449 cat-blob :1
2450 cat-blob :2
2453 git fast-import >actual &&
2454 test_cmp expect actual
2457 test_expect_success PIPE 'R: copy using cat-file' '
2458 expect_id=$(git hash-object big) &&
2459 expect_len=$(wc -c <big) &&
2460 echo $expect_id blob $expect_len >expect.response &&
2462 rm -f blobs &&
2463 cat >frontend <<-\FRONTEND_END &&
2464 #!/bin/sh
2465 FRONTEND_END
2467 mkfifo blobs &&
2469 export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&
2470 cat <<-\EOF &&
2471 feature cat-blob
2472 blob
2473 mark :1
2474 data <<BLOB
2476 cat big &&
2477 cat <<-\EOF &&
2478 BLOB
2479 cat-blob :1
2482 read blob_id type size <&3 &&
2483 echo "$blob_id $type $size" >response &&
2484 head_c $size >blob <&3 &&
2485 read newline <&3 &&
2487 cat <<-EOF &&
2488 commit refs/heads/copied
2489 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2490 data <<COMMIT
2491 copy big file as file3
2492 COMMIT
2493 M 644 inline file3
2494 data <<BLOB
2496 cat blob &&
2497 echo BLOB
2498 ) 3<blobs |
2499 git fast-import --cat-blob-fd=3 3>blobs &&
2500 git show copied:file3 >actual &&
2501 test_cmp expect.response response &&
2502 test_cmp big actual
2505 test_expect_success PIPE 'R: print blob mid-commit' '
2506 rm -f blobs &&
2507 echo "A blob from _before_ the commit." >expect &&
2508 mkfifo blobs &&
2510 exec 3<blobs &&
2511 cat <<-EOF &&
2512 feature cat-blob
2513 blob
2514 mark :1
2515 data <<BLOB
2516 A blob from _before_ the commit.
2517 BLOB
2518 commit refs/heads/temporary
2519 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2520 data <<COMMIT
2521 Empty commit
2522 COMMIT
2523 cat-blob :1
2526 read blob_id type size <&3 &&
2527 head_c $size >actual <&3 &&
2528 read newline <&3 &&
2530 echo
2532 git fast-import --cat-blob-fd=3 3>blobs &&
2533 test_cmp expect actual
2536 test_expect_success PIPE 'R: print staged blob within commit' '
2537 rm -f blobs &&
2538 echo "A blob from _within_ the commit." >expect &&
2539 mkfifo blobs &&
2541 exec 3<blobs &&
2542 cat <<-EOF &&
2543 feature cat-blob
2544 commit refs/heads/within
2545 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2546 data <<COMMIT
2547 Empty commit
2548 COMMIT
2549 M 644 inline within
2550 data <<BLOB
2551 A blob from _within_ the commit.
2552 BLOB
2555 to_get=$(
2556 echo "A blob from _within_ the commit." |
2557 git hash-object --stdin
2558 ) &&
2559 echo "cat-blob $to_get" &&
2561 read blob_id type size <&3 &&
2562 head_c $size >actual <&3 &&
2563 read newline <&3 &&
2565 echo deleteall
2567 git fast-import --cat-blob-fd=3 3>blobs &&
2568 test_cmp expect actual
2571 test_expect_success 'R: quiet option results in no stats being output' '
2572 cat >input <<-EOF &&
2573 option git quiet
2574 blob
2575 data 3
2580 cat input | git fast-import 2> output &&
2581 test_must_be_empty output
2584 test_expect_success 'R: feature done means terminating "done" is mandatory' '
2585 echo feature done | test_must_fail git fast-import &&
2586 test_must_fail git fast-import --done </dev/null
2589 test_expect_success 'R: terminating "done" with trailing gibberish is ok' '
2590 git fast-import <<-\EOF &&
2591 feature done
2592 done
2593 trailing gibberish
2595 git fast-import <<-\EOF
2596 done
2597 more trailing gibberish
2601 test_expect_success 'R: terminating "done" within commit' '
2602 cat >expect <<-\EOF &&
2603 OBJID
2604 :000000 100644 OBJID OBJID A hello.c
2605 :000000 100644 OBJID OBJID A hello2.c
2607 git fast-import <<-EOF &&
2608 commit refs/heads/done-ends
2609 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2610 data <<EOT
2611 Commit terminated by "done" command
2613 M 100644 inline hello.c
2614 data <<EOT
2615 Hello, world.
2617 C hello.c hello2.c
2618 done
2620 git rev-list done-ends |
2621 git diff-tree -r --stdin --root --always |
2622 sed -e "s/$_x40/OBJID/g" >actual &&
2623 test_cmp expect actual
2626 test_expect_success 'R: die on unknown option' '
2627 cat >input <<-EOF &&
2628 option git non-existing-option
2631 test_must_fail git fast-import <input
2634 test_expect_success 'R: unknown commandline options are rejected' '\
2635 test_must_fail git fast-import --non-existing-option < /dev/null
2638 test_expect_success 'R: die on invalid option argument' '
2639 echo "option git active-branches=-5" |
2640 test_must_fail git fast-import &&
2641 echo "option git depth=" |
2642 test_must_fail git fast-import &&
2643 test_must_fail git fast-import --depth="5 elephants" </dev/null
2646 test_expect_success 'R: ignore non-git options' '
2647 cat >input <<-EOF &&
2648 option non-existing-vcs non-existing-option
2651 git fast-import <input
2655 ## R: very large blobs
2657 test_expect_success 'R: blob bigger than threshold' '
2658 blobsize=$((2*1024*1024 + 53)) &&
2659 test-genrandom bar $blobsize >expect &&
2660 cat >input <<-INPUT_END &&
2661 commit refs/heads/big-file
2662 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2663 data <<COMMIT
2664 R - big file
2665 COMMIT
2667 M 644 inline big1
2668 data $blobsize
2669 INPUT_END
2670 cat expect >>input &&
2671 cat >>input <<-INPUT_END &&
2672 M 644 inline big2
2673 data $blobsize
2674 INPUT_END
2675 cat expect >>input &&
2676 echo >>input &&
2678 test_create_repo R &&
2679 git --git-dir=R/.git config fastimport.unpackLimit 0 &&
2680 git --git-dir=R/.git fast-import --big-file-threshold=1 <input
2683 test_expect_success 'R: verify created pack' '
2685 cd R &&
2686 verify_packs -v > ../verify
2690 test_expect_success 'R: verify written objects' '
2691 git --git-dir=R/.git cat-file blob big-file:big1 >actual &&
2692 test_cmp_bin expect actual &&
2693 a=$(git --git-dir=R/.git rev-parse big-file:big1) &&
2694 b=$(git --git-dir=R/.git rev-parse big-file:big2) &&
2695 test $a = $b
2698 test_expect_success 'R: blob appears only once' '
2699 n=$(grep $a verify | wc -l) &&
2700 test 1 = $n
2704 ### series S
2707 # Make sure missing spaces and EOLs after mark references
2708 # cause errors.
2710 # Setup:
2712 # 1--2--4
2713 # \ /
2714 # -3-
2716 # commit marks: 301, 302, 303, 304
2717 # blob marks: 403, 404, resp.
2718 # note mark: 202
2720 # The error message when a space is missing not at the
2721 # end of the line is:
2723 # Missing space after ..
2725 # or when extra characters come after the mark at the end
2726 # of the line:
2728 # Garbage after ..
2730 # or when the dataref is neither "inline " or a known SHA1,
2732 # Invalid dataref ..
2734 test_expect_success 'S: initialize for S tests' '
2735 test_tick &&
2737 cat >input <<-INPUT_END &&
2738 commit refs/heads/S
2739 mark :301
2740 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2741 data <<COMMIT
2742 commit 1
2743 COMMIT
2744 M 100644 inline hello.c
2745 data <<BLOB
2746 blob 1
2747 BLOB
2749 commit refs/heads/S
2750 mark :302
2751 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2752 data <<COMMIT
2753 commit 2
2754 COMMIT
2755 from :301
2756 M 100644 inline hello.c
2757 data <<BLOB
2758 blob 2
2759 BLOB
2761 blob
2762 mark :403
2763 data <<BLOB
2764 blob 3
2765 BLOB
2767 blob
2768 mark :202
2769 data <<BLOB
2770 note 2
2771 BLOB
2772 INPUT_END
2774 git fast-import --export-marks=marks <input
2778 # filemodify, three datarefs
2780 test_expect_success 'S: filemodify with garbage after mark must fail' '
2781 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2782 commit refs/heads/S
2783 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2784 data <<COMMIT
2785 commit N
2786 COMMIT
2787 M 100644 :403x hello.c
2789 cat err &&
2790 test_i18ngrep "space after mark" err
2793 # inline is misspelled; fast-import thinks it is some unknown dataref
2794 test_expect_success 'S: filemodify with garbage after inline must fail' '
2795 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2796 commit refs/heads/S
2797 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2798 data <<COMMIT
2799 commit N
2800 COMMIT
2801 M 100644 inlineX hello.c
2802 data <<BLOB
2803 inline
2804 BLOB
2806 cat err &&
2807 test_i18ngrep "nvalid dataref" err
2810 test_expect_success 'S: filemodify with garbage after sha1 must fail' '
2811 sha1=$(grep :403 marks | cut -d\ -f2) &&
2812 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2813 commit refs/heads/S
2814 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2815 data <<COMMIT
2816 commit N
2817 COMMIT
2818 M 100644 ${sha1}x hello.c
2820 cat err &&
2821 test_i18ngrep "space after SHA1" err
2825 # notemodify, three ways to say dataref
2827 test_expect_success 'S: notemodify with garabge after mark dataref must fail' '
2828 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2829 commit refs/heads/S
2830 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2831 data <<COMMIT
2832 commit S note dataref markref
2833 COMMIT
2834 N :202x :302
2836 cat err &&
2837 test_i18ngrep "space after mark" err
2840 test_expect_success 'S: notemodify with garbage after inline dataref must fail' '
2841 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2842 commit refs/heads/S
2843 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2844 data <<COMMIT
2845 commit S note dataref inline
2846 COMMIT
2847 N inlineX :302
2848 data <<BLOB
2849 note blob
2850 BLOB
2852 cat err &&
2853 test_i18ngrep "nvalid dataref" err
2856 test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '
2857 sha1=$(grep :202 marks | cut -d\ -f2) &&
2858 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2859 commit refs/heads/S
2860 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2861 data <<COMMIT
2862 commit S note dataref sha1
2863 COMMIT
2864 N ${sha1}x :302
2866 cat err &&
2867 test_i18ngrep "space after SHA1" err
2871 # notemodify, mark in commit-ish
2873 test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' '
2874 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2875 commit refs/heads/Snotes
2876 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2877 data <<COMMIT
2878 commit S note commit-ish
2879 COMMIT
2880 N :202 :302x
2882 cat err &&
2883 test_i18ngrep "after mark" err
2887 # from
2889 test_expect_success 'S: from with garbage after mark must fail' '
2890 test_must_fail \
2891 git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&
2892 commit refs/heads/S2
2893 mark :303
2894 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2895 data <<COMMIT
2896 commit 3
2897 COMMIT
2898 from :301x
2899 M 100644 :403 hello.c
2903 # go create the commit, need it for merge test
2904 git fast-import --import-marks=marks --export-marks=marks <<-EOF &&
2905 commit refs/heads/S2
2906 mark :303
2907 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2908 data <<COMMIT
2909 commit 3
2910 COMMIT
2911 from :301
2912 M 100644 :403 hello.c
2915 # now evaluate the error
2916 cat err &&
2917 test_i18ngrep "after mark" err
2922 # merge
2924 test_expect_success 'S: merge with garbage after mark must fail' '
2925 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2926 commit refs/heads/S
2927 mark :304
2928 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2929 data <<COMMIT
2930 merge 4
2931 COMMIT
2932 from :302
2933 merge :303x
2934 M 100644 :403 hello.c
2936 cat err &&
2937 test_i18ngrep "after mark" err
2941 # tag, from markref
2943 test_expect_success 'S: tag with garbage after mark must fail' '
2944 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2945 tag refs/tags/Stag
2946 from :302x
2947 tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2948 data <<TAG
2949 tag S
2952 cat err &&
2953 test_i18ngrep "after mark" err
2957 # cat-blob markref
2959 test_expect_success 'S: cat-blob with garbage after mark must fail' '
2960 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2961 cat-blob :403x
2963 cat err &&
2964 test_i18ngrep "after mark" err
2968 # ls markref
2970 test_expect_success 'S: ls with garbage after mark must fail' '
2971 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2972 ls :302x hello.c
2974 cat err &&
2975 test_i18ngrep "space after mark" err
2978 test_expect_success 'S: ls with garbage after sha1 must fail' '
2979 sha1=$(grep :302 marks | cut -d\ -f2) &&
2980 test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
2981 ls ${sha1}x hello.c
2983 cat err &&
2984 test_i18ngrep "space after tree-ish" err
2988 ### series T (ls)
2990 # Setup is carried over from series S.
2992 test_expect_success 'T: ls root tree' '
2993 sed -e "s/Z\$//" >expect <<-EOF &&
2994 040000 tree $(git rev-parse S^{tree}) Z
2996 sha1=$(git rev-parse --verify S) &&
2997 git fast-import --import-marks=marks <<-EOF >actual &&
2998 ls $sha1 ""
3000 test_cmp expect actual
3003 test_expect_success 'T: delete branch' '
3004 git branch to-delete &&
3005 git fast-import <<-EOF &&
3006 reset refs/heads/to-delete
3007 from 0000000000000000000000000000000000000000
3009 test_must_fail git rev-parse --verify refs/heads/to-delete
3012 test_expect_success 'T: empty reset doesnt delete branch' '
3013 git branch not-to-delete &&
3014 git fast-import <<-EOF &&
3015 reset refs/heads/not-to-delete
3017 git show-ref &&
3018 git rev-parse --verify refs/heads/not-to-delete
3022 ### series U (filedelete)
3025 test_expect_success 'U: initialize for U tests' '
3026 cat >input <<-INPUT_END &&
3027 commit refs/heads/U
3028 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3029 data <<COMMIT
3030 test setup
3031 COMMIT
3032 M 100644 inline hello.c
3033 data <<BLOB
3034 blob 1
3035 BLOB
3036 M 100644 inline good/night.txt
3037 data <<BLOB
3038 sleep well
3039 BLOB
3040 M 100644 inline good/bye.txt
3041 data <<BLOB
3042 au revoir
3043 BLOB
3045 INPUT_END
3047 git fast-import <input
3050 test_expect_success 'U: filedelete file succeeds' '
3051 cat >input <<-INPUT_END &&
3052 commit refs/heads/U
3053 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3054 data <<COMMIT
3055 delete good/night.txt
3056 COMMIT
3057 from refs/heads/U^0
3058 D good/night.txt
3060 INPUT_END
3062 git fast-import <input
3065 test_expect_success 'U: validate file delete result' '
3066 cat >expect <<-EOF &&
3067 :100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D good/night.txt
3070 git diff-tree -M -r U^1 U >actual &&
3072 compare_diff_raw expect actual
3075 test_expect_success 'U: filedelete directory succeeds' '
3076 cat >input <<-INPUT_END &&
3077 commit refs/heads/U
3078 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3079 data <<COMMIT
3080 delete good dir
3081 COMMIT
3082 from refs/heads/U^0
3083 D good
3085 INPUT_END
3087 git fast-import <input
3090 test_expect_success 'U: validate directory delete result' '
3091 cat >expect <<-EOF &&
3092 :100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D good/bye.txt
3095 git diff-tree -M -r U^1 U >actual &&
3097 compare_diff_raw expect actual
3100 test_expect_success 'U: filedelete root succeeds' '
3101 cat >input <<-INPUT_END &&
3102 commit refs/heads/U
3103 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3104 data <<COMMIT
3105 must succeed
3106 COMMIT
3107 from refs/heads/U^0
3108 D ""
3110 INPUT_END
3112 git fast-import <input
3115 test_expect_success 'U: validate root delete result' '
3116 cat >expect <<-EOF &&
3117 :100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D hello.c
3120 git diff-tree -M -r U^1 U >actual &&
3122 compare_diff_raw expect actual
3125 test_done