3 # Copyright (c) 2007 Shawn Pearce
6 test_description
='test git fast-import utility'
8 .
"$TEST_DIRECTORY"/diff-lib.sh
;# test-lib chdir's into trash
10 # Print $1 bytes from stdin to stdout.
12 # This could be written as "head -c $1", but IRIX "head" does not
13 # support the -c option.
19 my $nread = sysread(STDIN, $s, $len);
20 die "cannot read: $!" unless defined($nread);
37 file5_data
='an inline file.
38 we should see it later.'
51 test_expect_success
'empty stream succeeds' '
52 git fast-import </dev/null
55 cat >input
<<INPUT_END
72 commit refs/heads/master
74 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
86 An annotated tag without a tagger
91 'A: create pack from stdin' \
92 'git fast-import --export-marks=marks.out <input &&
93 git whatchanged master'
96 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
99 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
100 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
104 test_expect_success \
106 'git cat-file commit master | sed 1d >actual &&
107 test_cmp expect actual'
114 test_expect_success \
116 'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
117 test_cmp expect actual'
119 echo "$file2_data" >expect
120 test_expect_success \
122 'git cat-file blob master:file2 >actual && test_cmp expect actual'
124 echo "$file3_data" >expect
125 test_expect_success \
127 'git cat-file blob master:file3 >actual && test_cmp expect actual'
129 printf "$file4_data" >expect
130 test_expect_success \
132 'git cat-file blob master:file4 >actual && test_cmp expect actual'
135 object $(git rev-parse refs/heads/master)
139 An annotated tag without a tagger
141 test_expect_success
'A: verify tag/series-A' '
142 git cat-file tag tags/series-A >actual &&
143 test_cmp expect actual
147 :2 `git rev-parse --verify master:file2`
148 :3 `git rev-parse --verify master:file3`
149 :4 `git rev-parse --verify master:file4`
150 :5 `git rev-parse --verify master^0`
152 test_expect_success \
153 'A: verify marks output' \
154 'test_cmp expect marks.out'
156 test_expect_success \
157 'A: verify marks import' \
159 --import-marks=marks.out \
160 --export-marks=marks.new \
162 test_cmp expect marks.new'
165 cat >input
<<INPUT_END
166 commit refs/heads/verify--import-marks
167 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
173 M 755 :2 copy-of-file2
176 test_expect_success \
177 'A: verify marks import does not crash' \
178 'git fast-import --import-marks=marks.out <input &&
179 git whatchanged verify--import-marks'
180 test_expect_success \
182 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
184 :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
186 git diff-tree
-M -r master verify--import-marks
>actual
187 test_expect_success \
189 'compare_diff_raw expect actual &&
190 test `git rev-parse --verify master:file2` \
191 = `git rev-parse --verify verify--import-marks:copy-of-file2`'
194 mt
=$
(git hash-object
--stdin < /dev
/null
)
199 cat >input.commit
<<EOF
200 commit refs/heads/verify--dump-marks
201 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
203 test the sparse array dumping routines with exponentially growing marks
211 while test "$i" -lt 27; do
212 cat >>input.blob
<<EOF
223 echo "M 100644 :$l l$i" >>input.commit
224 echo "M 100644 :$m m$i" >>input.commit
225 echo "M 100644 :$n n$i" >>input.commit
227 echo ":$l $mt" >>marks.exp
228 echo ":$m $mt" >>marks.exp
229 echo ":$n $mt" >>marks.exp
231 printf "100644 blob $mt\tl$i\n" >>tree.exp
232 printf "100644 blob $mt\tm$i\n" >>tree.exp
233 printf "100644 blob $mt\tn$i\n" >>tree.exp
242 sort tree.exp
> tree.exp_s
244 test_expect_success
'A: export marks with large values' '
245 cat input.blob input.commit | git fast-import --export-marks=marks.large &&
246 git ls-tree refs/heads/verify--dump-marks >tree.out &&
247 test_cmp tree.exp_s tree.out &&
248 test_cmp marks.exp marks.large'
255 cat >input
<<INPUT_END
256 commit refs/heads/branch
258 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
263 from refs/heads/master
264 M 755 0000000000000000000000000000000000000001 zero1
267 test_expect_success
'B: fail on invalid blob sha1' '
268 test_must_fail git fast-import <input
270 rm -f .git
/objects
/pack_
* .git
/objects
/index_
*
272 cat >input
<<INPUT_END
273 commit .badbranchname
274 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
279 from refs/heads/master
282 test_expect_success
'B: fail on invalid branch name ".badbranchname"' '
283 test_must_fail git fast-import <input
285 rm -f .git
/objects
/pack_
* .git
/objects
/index_
*
287 cat >input
<<INPUT_END
288 commit bad[branch]name
289 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
294 from refs/heads/master
297 test_expect_success
'B: fail on invalid branch name "bad[branch]name"' '
298 test_must_fail git fast-import <input
300 rm -f .git
/objects
/pack_
* .git
/objects
/index_
*
302 cat >input
<<INPUT_END
304 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
309 from refs/heads/master
312 test_expect_success \
313 'B: accept branch name "TEMP_TAG"' \
314 'git fast-import <input &&
315 test -f .git/TEMP_TAG &&
316 test `git rev-parse master` = `git rev-parse TEMP_TAG^`'
323 newf
=`echo hi newf | git hash-object -w --stdin`
324 oldf
=`git rev-parse --verify master:file2`
326 cat >input
<<INPUT_END
327 commit refs/heads/branch
328 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
333 from refs/heads/master
334 M 644 $oldf file2/oldf
335 M 755 $newf file2/newf
339 test_expect_success \
340 'C: incremental import create pack from stdin' \
341 'git fast-import <input &&
342 git whatchanged branch'
343 test_expect_success \
345 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
346 test_expect_success \
347 'C: validate reuse existing blob' \
348 'test $newf = `git rev-parse --verify branch:file2/newf` &&
349 test $oldf = `git rev-parse --verify branch:file2/oldf`'
352 parent `git rev-parse --verify master^0`
353 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
354 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
358 test_expect_success \
360 'git cat-file commit branch | sed 1d >actual &&
361 test_cmp expect actual'
364 :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
365 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
366 :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
368 git diff-tree
-M -r master branch
>actual
369 test_expect_success \
370 'C: validate rename result' \
371 'compare_diff_raw expect actual'
378 cat >input
<<INPUT_END
379 commit refs/heads/branch
380 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
385 from refs/heads/branch^0
386 M 644 inline newdir/interesting
391 M 755 inline newdir/exec.sh
397 test_expect_success \
398 'D: inline data in commit' \
399 'git fast-import <input &&
400 git whatchanged branch'
401 test_expect_success \
403 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
406 :000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A newdir/exec.sh
407 :000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A newdir/interesting
409 git diff-tree
-M -r branch^ branch
>actual
410 test_expect_success \
411 'D: validate new files added' \
412 'compare_diff_raw expect actual'
414 echo "$file5_data" >expect
415 test_expect_success \
417 'git cat-file blob branch:newdir/interesting >actual &&
418 test_cmp expect actual'
420 echo "$file6_data" >expect
421 test_expect_success \
423 'git cat-file blob branch:newdir/exec.sh >actual &&
424 test_cmp expect actual'
430 cat >input
<<INPUT_END
431 commit refs/heads/branch
432 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
433 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
438 from refs/heads/branch^0
441 test_expect_success
'E: rfc2822 date, --date-format=raw' '
442 test_must_fail git fast-import --date-format=raw <input
444 test_expect_success \
445 'E: rfc2822 date, --date-format=rfc2822' \
446 'git fast-import --date-format=rfc2822 <input'
447 test_expect_success \
449 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
452 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
453 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
457 test_expect_success \
459 'git cat-file commit branch | sed 1,2d >actual &&
460 test_cmp expect actual'
466 old_branch
=`git rev-parse --verify branch^0`
468 cat >input
<<INPUT_END
469 commit refs/heads/branch
470 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
472 losing things already?
475 from refs/heads/branch~1
477 reset refs/heads/other
478 from refs/heads/branch
481 test_expect_success \
482 'F: non-fast-forward update skips' \
483 'if git fast-import <input
485 echo BAD gfi did not fail
488 if test $old_branch = `git rev-parse --verify branch^0`
490 : branch unaffected and failure returned
493 echo BAD gfi changed branch $old_branch
498 test_expect_success \
500 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
503 tree `git rev-parse branch~1^{tree}`
504 parent `git rev-parse branch~1`
505 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
506 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
508 losing things already?
510 test_expect_success \
511 'F: verify other commit' \
512 'git cat-file commit other >actual &&
513 test_cmp expect actual'
519 old_branch
=`git rev-parse --verify branch^0`
521 cat >input
<<INPUT_END
522 commit refs/heads/branch
523 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
525 losing things already?
528 from refs/heads/branch~1
531 test_expect_success \
532 'G: non-fast-forward update forced' \
533 'git fast-import --force <input'
534 test_expect_success \
536 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
537 test_expect_success \
538 'G: branch changed, but logged' \
539 'test $old_branch != `git rev-parse --verify branch^0` &&
540 test $old_branch = `git rev-parse --verify branch@{1}`'
547 cat >input
<<INPUT_END
549 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
554 from refs/heads/branch^0
555 M 644 inline i-will-die
557 this file will never exist.
561 M 644 inline h/e/l/lo
567 test_expect_success \
568 'H: deletall, add 1' \
569 'git fast-import <input &&
571 test_expect_success \
573 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
576 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
577 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
578 :100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
579 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
580 :100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
582 git diff-tree
-M -r H^ H
>actual
583 test_expect_success \
584 'H: validate old files removed, new files added' \
585 'compare_diff_raw expect actual'
587 echo "$file5_data" >expect
588 test_expect_success \
590 'git cat-file blob H:h/e/l/lo >actual &&
591 test_cmp expect actual'
597 cat >input
<<INPUT_END
598 commit refs/heads/export-boundary
599 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
601 we have a border. its only 40 characters wide.
604 from refs/heads/branch
607 test_expect_success \
608 'I: export-pack-edges' \
609 'git fast-import --export-pack-edges=edges.list <input'
612 .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
614 test_expect_success \
615 'I: verify edge list' \
616 'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
617 test_cmp expect actual'
623 cat >input
<<INPUT_END
625 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
630 from refs/heads/branch
635 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
641 test_expect_success \
642 'J: reset existing branch creates empty commit' \
643 'git fast-import <input'
644 test_expect_success \
645 'J: branch has 1 commit, empty tree' \
646 'test 1 = `git rev-list J | wc -l` &&
647 test 0 = `git ls-tree J | wc -l`'
653 cat >input
<<INPUT_END
655 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
660 from refs/heads/branch
663 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
668 from refs/heads/branch^1
671 test_expect_success \
672 'K: reinit branch with from' \
673 'git fast-import <input'
674 test_expect_success \
675 'K: verify K^1 = branch^1' \
676 'test `git rev-parse --verify branch^1` \
677 = `git rev-parse --verify K^1`'
683 cat >input
<<INPUT_END
697 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
707 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
717 cat >expect
<<EXPECT_END
718 :100644 100644 4268632... 55d3a52... M b.
719 :040000 040000 0ae5cac... 443c768... M b
720 :100644 100644 4268632... 55d3a52... M ba
723 test_expect_success \
724 'L: verify internal tree sorting' \
725 'git fast-import <input &&
726 git diff-tree --abbrev --raw L^ L >output &&
727 test_cmp expect output'
734 cat >input
<<INPUT_END
736 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
741 from refs/heads/branch^0
742 R file2/newf file2/n.e.w.f
747 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
749 test_expect_success \
750 'M: rename file in same subdirectory' \
751 'git fast-import <input &&
752 git diff-tree -M -r M1^ M1 >actual &&
753 compare_diff_raw expect actual'
755 cat >input
<<INPUT_END
757 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
762 from refs/heads/branch^0
763 R file2/newf i/am/new/to/you
768 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
770 test_expect_success \
771 'M: rename file to new subdirectory' \
772 'git fast-import <input &&
773 git diff-tree -M -r M2^ M2 >actual &&
774 compare_diff_raw expect actual'
776 cat >input
<<INPUT_END
778 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
789 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
791 test_expect_success \
792 'M: rename subdirectory to new subdirectory' \
793 'git fast-import <input &&
794 git diff-tree -M -r M3^ M3 >actual &&
795 compare_diff_raw expect actual'
802 cat >input
<<INPUT_END
804 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
809 from refs/heads/branch^0
810 C file2/newf file2/n.e.w.f
815 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
817 test_expect_success \
818 'N: copy file in same subdirectory' \
819 'git fast-import <input &&
820 git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
821 compare_diff_raw expect actual'
823 cat >input
<<INPUT_END
825 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
830 from refs/heads/branch^0
834 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
836 modify directory copy
839 M 644 inline file3/file5
847 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
848 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
849 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
851 test_expect_success \
852 'N: copy then modify subdirectory' \
853 'git fast-import <input &&
854 git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
855 compare_diff_raw expect actual'
857 cat >input
<<INPUT_END
859 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
864 from refs/heads/branch^0
865 M 644 inline file2/file5
875 test_expect_success \
876 'N: copy dirty subdirectory' \
877 'git fast-import <input &&
878 test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`'
880 test_expect_success \
881 'N: copy directory by id' \
882 'cat >expect <<-\EOF &&
883 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
884 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
886 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
887 cat >input <<-INPUT_END &&
889 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
894 from refs/heads/branch^0
895 M 040000 $subdir file3
897 git fast-import <input &&
898 git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
899 compare_diff_raw expect actual'
901 test_expect_success \
902 'N: copy root directory by tree hash' \
903 'cat >expect <<-\EOF &&
904 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file3/newf
905 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file3/oldf
907 root=$(git rev-parse refs/heads/branch^0^{tree}) &&
908 cat >input <<-INPUT_END &&
910 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
912 copy root directory by tree hash
915 from refs/heads/branch^0
918 git fast-import <input &&
919 git diff-tree -C --find-copies-harder -r N4 N6 >actual &&
920 compare_diff_raw expect actual'
922 test_expect_success \
923 'N: modify copied tree' \
924 'cat >expect <<-\EOF &&
925 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
926 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
927 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
929 subdir=$(git rev-parse refs/heads/branch^0:file2) &&
930 cat >input <<-INPUT_END &&
932 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
937 from refs/heads/branch^0
938 M 040000 $subdir file3
941 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
943 modify directory copy
946 M 644 inline file3/file5
951 git fast-import <input &&
952 git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&
953 compare_diff_raw expect actual'
955 test_expect_success \
956 'N: reject foo/ syntax' \
957 'subdir=$(git rev-parse refs/heads/branch^0:file2) &&
958 test_must_fail git fast-import <<-INPUT_END
959 commit refs/heads/N5B
960 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
962 copy with invalid syntax
965 from refs/heads/branch^0
966 M 040000 $subdir file3/
969 test_expect_success \
970 'N: copy to root by id and modify' \
971 'echo "hello, world" >expect.foo &&
972 echo hello >expect.bar &&
973 git fast-import <<-SETUP_END &&
975 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
987 tree=$(git rev-parse --verify N7:) &&
988 git fast-import <<-INPUT_END &&
990 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
992 copy to root by id and modify
1001 git show N8:foo/foo >actual.foo &&
1002 git show N8:foo/bar >actual.bar &&
1003 test_cmp expect.foo actual.foo &&
1004 test_cmp expect.bar actual.bar'
1006 test_expect_success \
1007 'N: extract subtree' \
1008 'branch=$(git rev-parse --verify refs/heads/branch^{tree}) &&
1009 cat >input <<-INPUT_END &&
1010 commit refs/heads/N9
1011 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1013 extract subtree branch:newdir
1019 git fast-import <input &&
1020 git diff --exit-code branch:newdir N9'
1022 test_expect_success \
1023 'N: modify subtree, extract it, and modify again' \
1024 'echo hello >expect.baz &&
1025 echo hello, world >expect.qux &&
1026 git fast-import <<-SETUP_END &&
1027 commit refs/heads/N10
1028 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1034 M 644 inline foo/bar/baz
1040 tree=$(git rev-parse --verify N10:) &&
1041 git fast-import <<-INPUT_END &&
1042 commit refs/heads/N11
1043 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1045 copy to root by id and modify
1049 M 100644 inline foo/bar/qux
1054 C "bar/qux" "bar/quux"
1056 git show N11:bar/baz >actual.baz &&
1057 git show N11:bar/qux >actual.qux &&
1058 git show N11:bar/quux >actual.quux &&
1059 test_cmp expect.baz actual.baz &&
1060 test_cmp expect.qux actual.qux &&
1061 test_cmp expect.qux actual.quux'
1067 cat >input
<<INPUT_END
1069 commit refs/heads/O1
1070 # -- ignore all of this text
1071 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1072 # $GIT_COMMITTER_NAME has inserted here for his benefit.
1074 dirty directory copy
1077 # don't forget the import blank line!
1079 # yes, we started from our usual base of branch^0.
1081 from refs/heads/branch^0
1082 # and we need to reuse file2/file5 from N3 above.
1083 M 644 inline file2/file5
1084 # otherwise the tree will be different
1089 # don't forget to copy file2 to file3
1092 # or to delete file5 from file2.
1098 test_expect_success \
1099 'O: comments are all skipped' \
1100 'git fast-import <input &&
1101 test `git rev-parse N3` = `git rev-parse O1`'
1103 cat >input
<<INPUT_END
1104 commit refs/heads/O2
1105 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1107 dirty directory copy
1109 from refs/heads/branch^0
1110 M 644 inline file2/file5
1119 test_expect_success \
1120 'O: blank lines not necessary after data commands' \
1121 'git fast-import <input &&
1122 test `git rev-parse N3` = `git rev-parse O2`'
1124 test_expect_success \
1125 'O: repack before next test' \
1128 cat >input
<<INPUT_END
1129 commit refs/heads/O3
1130 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1134 commit refs/heads/O3
1135 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1140 commit refs/heads/O3
1142 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1147 commit refs/heads/O3
1148 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1152 reset refs/tags/O3-2nd
1154 reset refs/tags/O3-3rd
1158 cat >expect
<<INPUT_END
1164 test_expect_success \
1165 'O: blank lines not necessary after other commands' \
1166 'git fast-import <input &&
1167 test 8 = `find .git/objects/pack -type f | wc -l` &&
1168 test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
1169 git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
1170 test_cmp expect actual'
1172 cat >input
<<INPUT_END
1173 commit refs/heads/O4
1174 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1178 commit refs/heads/O4
1179 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1183 progress Two commits down, 2 to go!
1184 commit refs/heads/O4
1185 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1189 progress Three commits down, 1 to go!
1190 commit refs/heads/O4
1191 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1197 test_expect_success \
1198 'O: progress outputs as requested by input' \
1199 'git fast-import <input >actual &&
1200 grep "progress " <input >expect &&
1201 test_cmp expect actual'
1204 ### series P (gitlinks)
1207 cat >input
<<INPUT_END
1213 reset refs/heads/sub
1214 commit refs/heads/sub
1216 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1229 commit refs/heads/subuse1
1231 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1234 from refs/heads/master
1235 M 100644 :3 .gitmodules
1244 commit refs/heads/sub
1246 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1252 commit refs/heads/subuse1
1254 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1262 test_expect_success \
1263 'P: supermodule & submodule mix' \
1264 'git fast-import <input &&
1265 git checkout subuse1 &&
1266 rm -rf sub && mkdir sub && (cd sub &&
1268 git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
1269 git checkout master) &&
1270 git submodule init &&
1271 git submodule update'
1273 SUBLAST
=$
(git rev-parse
--verify sub
)
1274 SUBPREV
=$
(git rev-parse
--verify sub^
)
1276 cat >input
<<INPUT_END
1285 commit refs/heads/subuse2
1287 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1290 from refs/heads/master
1291 M 100644 :1 .gitmodules
1292 M 160000 $SUBPREV sub
1294 commit refs/heads/subuse2
1296 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1300 M 160000 $SUBLAST sub
1304 test_expect_success \
1305 'P: verbatim SHA gitlinks' \
1306 'git branch -D sub &&
1307 git gc && git prune &&
1308 git fast-import <input &&
1309 test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)'
1312 cat >input
<<INPUT_END
1313 commit refs/heads/subuse3
1315 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1320 from refs/heads/subuse2
1328 test_expect_success
'P: fail on inline gitlink' '
1329 test_must_fail git fast-import <input'
1332 cat >input
<<INPUT_END
1339 commit refs/heads/subuse3
1341 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1346 from refs/heads/subuse2
1351 test_expect_success
'P: fail on blob mark in gitlink' '
1352 test_must_fail git fast-import <input'
1355 ### series Q (notes)
1358 note1_data
="The first note for the first commit"
1359 note2_data
="The first note for the second commit"
1360 note3_data
="The first note for the third commit"
1361 note1b_data
="The second note for the first commit"
1362 note1c_data
="The third note for the first commit"
1363 note2b_data
="The second note for the second commit"
1366 cat >input
<<INPUT_END
1373 commit refs/heads/notes-test
1375 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1386 commit refs/heads/notes-test
1388 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1395 commit refs/heads/notes-test
1397 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1424 commit refs/notes/foobar
1426 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1438 commit refs/notes/foobar
1440 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1450 commit refs/notes/foobar2
1452 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1462 commit refs/notes/foobar
1464 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1477 test_expect_success \
1479 'git fast-import <input &&
1480 git whatchanged notes-test'
1481 test_expect_success \
1483 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
1485 commit1
=$
(git rev-parse notes-test~
2)
1486 commit2
=$
(git rev-parse notes-test^
)
1487 commit3
=$
(git rev-parse notes-test
)
1490 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1491 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1495 test_expect_success \
1496 'Q: verify first commit' \
1497 'git cat-file commit notes-test~2 | sed 1d >actual &&
1498 test_cmp expect actual'
1502 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1503 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1507 test_expect_success \
1508 'Q: verify second commit' \
1509 'git cat-file commit notes-test^ | sed 1d >actual &&
1510 test_cmp expect actual'
1514 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1515 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1519 test_expect_success \
1520 'Q: verify third commit' \
1521 'git cat-file commit notes-test | sed 1d >actual &&
1522 test_cmp expect actual'
1525 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1526 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1530 test_expect_success \
1531 'Q: verify first notes commit' \
1532 'git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&
1533 test_cmp expect actual'
1535 cat >expect.unsorted
<<EOF
1536 100644 blob $commit1
1537 100644 blob $commit2
1538 100644 blob $commit3
1540 cat expect.unsorted |
sort >expect
1541 test_expect_success \
1542 'Q: verify first notes tree' \
1543 'git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1544 test_cmp expect actual'
1546 echo "$note1_data" >expect
1547 test_expect_success \
1548 'Q: verify first note for first commit' \
1549 'git cat-file blob refs/notes/foobar~2:$commit1 >actual && test_cmp expect actual'
1551 echo "$note2_data" >expect
1552 test_expect_success \
1553 'Q: verify first note for second commit' \
1554 'git cat-file blob refs/notes/foobar~2:$commit2 >actual && test_cmp expect actual'
1556 echo "$note3_data" >expect
1557 test_expect_success \
1558 'Q: verify first note for third commit' \
1559 'git cat-file blob refs/notes/foobar~2:$commit3 >actual && test_cmp expect actual'
1562 parent `git rev-parse --verify refs/notes/foobar~2`
1563 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1564 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1568 test_expect_success \
1569 'Q: verify second notes commit' \
1570 'git cat-file commit refs/notes/foobar^ | sed 1d >actual &&
1571 test_cmp expect actual'
1573 cat >expect.unsorted
<<EOF
1574 100644 blob $commit1
1575 100644 blob $commit2
1576 100644 blob $commit3
1578 cat expect.unsorted |
sort >expect
1579 test_expect_success \
1580 'Q: verify second notes tree' \
1581 'git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1582 test_cmp expect actual'
1584 echo "$note1b_data" >expect
1585 test_expect_success \
1586 'Q: verify second note for first commit' \
1587 'git cat-file blob refs/notes/foobar^:$commit1 >actual && test_cmp expect actual'
1589 echo "$note2_data" >expect
1590 test_expect_success \
1591 'Q: verify first note for second commit' \
1592 'git cat-file blob refs/notes/foobar^:$commit2 >actual && test_cmp expect actual'
1594 echo "$note3_data" >expect
1595 test_expect_success \
1596 'Q: verify first note for third commit' \
1597 'git cat-file blob refs/notes/foobar^:$commit3 >actual && test_cmp expect actual'
1600 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1601 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1605 test_expect_success \
1606 'Q: verify third notes commit' \
1607 'git cat-file commit refs/notes/foobar2 | sed 1d >actual &&
1608 test_cmp expect actual'
1610 cat >expect.unsorted
<<EOF
1611 100644 blob $commit1
1613 cat expect.unsorted |
sort >expect
1614 test_expect_success \
1615 'Q: verify third notes tree' \
1616 'git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1617 test_cmp expect actual'
1619 echo "$note1c_data" >expect
1620 test_expect_success \
1621 'Q: verify third note for first commit' \
1622 'git cat-file blob refs/notes/foobar2:$commit1 >actual && test_cmp expect actual'
1625 parent `git rev-parse --verify refs/notes/foobar^`
1626 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1627 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1631 test_expect_success \
1632 'Q: verify fourth notes commit' \
1633 'git cat-file commit refs/notes/foobar | sed 1d >actual &&
1634 test_cmp expect actual'
1636 cat >expect.unsorted
<<EOF
1637 100644 blob $commit2
1639 cat expect.unsorted |
sort >expect
1640 test_expect_success \
1641 'Q: verify fourth notes tree' \
1642 'git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1643 test_cmp expect actual'
1645 echo "$note2b_data" >expect
1646 test_expect_success \
1647 'Q: verify second note for second commit' \
1648 'git cat-file blob refs/notes/foobar:$commit2 >actual && test_cmp expect actual'
1651 ### series R (feature and option)
1655 feature no-such-feature-exists
1658 test_expect_success
'R: abort on unsupported feature' '
1659 test_must_fail git fast-import <input
1663 feature date-format=now
1666 test_expect_success
'R: supported feature is accepted' '
1667 git fast-import <input
1674 feature date-format=now
1677 test_expect_success
'R: abort on receiving feature after data command' '
1678 test_must_fail git fast-import <input
1682 feature import-marks=git.marks
1683 feature import-marks=git2.marks
1686 test_expect_success
'R: only one import-marks feature allowed per stream' '
1687 test_must_fail git fast-import <input
1691 feature export-marks=git.marks
1699 test_expect_success \
1700 'R: export-marks feature results in a marks file being created' \
1701 'cat input | git fast-import &&
1704 test_expect_success \
1705 'R: export-marks options can be overriden by commandline options' \
1706 'cat input | git fast-import --export-marks=other.marks &&
1707 grep :1 other.marks'
1710 feature import-marks=marks.out
1711 feature export-marks=marks.new
1714 test_expect_success \
1715 'R: import to output marks works without any content' \
1716 'cat input | git fast-import &&
1717 test_cmp marks.out marks.new'
1720 feature import-marks=nonexistant.marks
1721 feature export-marks=marks.new
1724 test_expect_success \
1725 'R: import marks prefers commandline marks file over the stream' \
1726 'cat input | git fast-import --import-marks=marks.out &&
1727 test_cmp marks.out marks.new'
1731 feature import-marks=nonexistant.marks
1732 feature export-marks=combined.marks
1735 test_expect_success
'R: multiple --import-marks= should be honoured' '
1736 head -n2 marks.out > one.marks &&
1737 tail -n +3 marks.out > two.marks &&
1738 git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
1739 test_cmp marks.out combined.marks
1743 feature relative-marks
1744 feature import-marks=relative.in
1745 feature export-marks=relative.out
1748 test_expect_success
'R: feature relative-marks should be honoured' '
1749 mkdir -p .git/info/fast-import/ &&
1750 cp marks.new .git/info/fast-import/relative.in &&
1751 git fast-import <input &&
1752 test_cmp marks.new .git/info/fast-import/relative.out
1756 feature relative-marks
1757 feature import-marks=relative.in
1758 feature no-relative-marks
1759 feature export-marks=non-relative.out
1762 test_expect_success
'R: feature no-relative-marks should be honoured' '
1763 git fast-import <input &&
1764 test_cmp marks.new non-relative.out
1767 test_expect_success
'R: feature cat-blob supported' '
1768 echo "feature cat-blob" |
1772 test_expect_success
'R: cat-blob-fd must be a nonnegative integer' '
1773 test_must_fail git fast-import --cat-blob-fd=-1 </dev/null
1776 test_expect_success
'R: print old blob' '
1777 blob=$(echo "yes it can" | git hash-object -w --stdin) &&
1778 cat >expect <<-EOF &&
1783 echo "cat-blob $blob" |
1784 git fast-import --cat-blob-fd=6 6>actual &&
1785 test_cmp expect actual
1788 test_expect_success
'R: in-stream cat-blob-fd not respected' '
1789 echo hello >greeting &&
1790 blob=$(git hash-object -w greeting) &&
1791 cat >expect <<-EOF &&
1796 git fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&
1799 test_cmp expect actual.3 &&
1800 test_cmp empty actual.1 &&
1801 git fast-import 3>actual.3 >actual.1 <<-EOF &&
1802 option cat-blob-fd=3
1805 test_cmp empty actual.3 &&
1806 test_cmp expect actual.1
1809 test_expect_success
'R: print new blob' '
1810 blob=$(echo "yep yep yep" | git hash-object --stdin) &&
1811 cat >expect <<-EOF &&
1816 git fast-import --cat-blob-fd=6 6>actual <<-\EOF &&
1824 test_cmp expect actual
1827 test_expect_success
'R: print new blob by sha1' '
1828 blob=$(echo "a new blob named by sha1" | git hash-object --stdin) &&
1829 cat >expect <<-EOF &&
1831 a new blob named by sha1
1834 git fast-import --cat-blob-fd=6 6>actual <<-EOF &&
1837 a new blob named by sha1
1841 test_cmp expect actual
1844 test_expect_success
'setup: big file' '
1846 echo "the quick brown fox jumps over the lazy dog" >big &&
1849 cat big big big big >bigger &&
1850 cat bigger bigger bigger bigger >big ||
1856 test_expect_success
'R: print two blobs to stdout' '
1857 blob1=$(git hash-object big) &&
1858 blob1_len=$(wc -c <big) &&
1859 blob2=$(echo hello | git hash-object --stdin) &&
1861 echo ${blob1} blob $blob1_len &&
1871 cat <<-\END_PART1 &&
1888 git fast-import >actual &&
1889 test_cmp expect actual
1892 test_expect_success
'setup: have pipes?' '
1896 test_set_prereq PIPE
1900 test_expect_success PIPE
'R: copy using cat-file' '
1901 expect_id=$(git hash-object big) &&
1902 expect_len=$(wc -c <big) &&
1903 echo $expect_id blob $expect_len >expect.response &&
1906 cat >frontend <<-\FRONTEND_END &&
1912 export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&
1925 read blob_id type size <&3 &&
1926 echo "$blob_id $type $size" >response &&
1927 head_c $size >blob <&3 &&
1931 commit refs/heads/copied
1932 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1934 copy big file as file3
1942 git fast-import --cat-blob-fd=3 3>blobs &&
1943 git show copied:file3 >actual &&
1944 test_cmp expect.response response &&
1948 test_expect_success PIPE
'R: print blob mid-commit' '
1950 echo "A blob from _before_ the commit." >expect &&
1959 A blob from _before_ the commit.
1961 commit refs/heads/temporary
1962 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1969 read blob_id type size <&3 &&
1970 head_c $size >actual <&3 &&
1975 git fast-import --cat-blob-fd=3 3>blobs &&
1976 test_cmp expect actual
1979 test_expect_success PIPE
'R: print staged blob within commit' '
1981 echo "A blob from _within_ the commit." >expect &&
1987 commit refs/heads/within
1988 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1994 A blob from _within_ the commit.
1999 echo "A blob from _within_ the commit." |
2000 git hash-object --stdin
2002 echo "cat-blob $to_get" &&
2004 read blob_id type size <&3 &&
2005 head_c $size >actual <&3 &&
2010 git fast-import --cat-blob-fd=3 3>blobs &&
2011 test_cmp expect actual
2022 test_expect_success
'R: quiet option results in no stats being output' '
2023 cat input | git fast-import 2> output &&
2024 test_cmp empty output
2028 option git non-existing-option
2031 test_expect_success
'R: die on unknown option' '
2032 test_must_fail git fast-import <input
2035 test_expect_success
'R: unknown commandline options are rejected' '\
2036 test_must_fail git fast-import --non-existing-option < /dev/null
2039 test_expect_success
'R: die on invalid option argument' '
2040 echo "option git active-branches=-5" |
2041 test_must_fail git fast-import &&
2042 echo "option git depth=" |
2043 test_must_fail git fast-import &&
2044 test_must_fail git fast-import --depth="5 elephants" </dev/null
2048 option non-existing-vcs non-existing-option
2051 test_expect_success
'R: ignore non-git options' '
2052 git fast-import <input
2056 ## R: very large blobs
2058 blobsize
=$
((2*1024*1024 + 53))
2059 test-genrandom bar
$blobsize >expect
2060 cat >input
<<INPUT_END
2061 commit refs/heads/big-file
2062 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2071 cat >>input
<<INPUT_END
2078 test_expect_success \
2079 'R: blob bigger than threshold' \
2080 'test_create_repo R &&
2081 git --git-dir=R/.git fast-import --big-file-threshold=1 <input'
2082 test_expect_success \
2083 'R: verify created pack' \
2085 for p in R/.git/objects/pack/*.pack;
2087 git verify-pack -v $p >>verify || exit;
2089 test_expect_success \
2090 'R: verify written objects' \
2091 'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&
2092 test_cmp expect actual &&
2093 a=$(git --git-dir=R/.git rev-parse big-file:big1) &&
2094 b=$(git --git-dir=R/.git rev-parse big-file:big2) &&
2096 test_expect_success \
2097 'R: blob appears only once' \
2098 'n=$(grep $a verify | wc -l) &&