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
20 file5_data
='an inline file.
21 we should see it later.'
31 cat >input
<<INPUT_END
48 commit refs/heads/master
50 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
62 An annotated tag without a tagger
67 'A: create pack from stdin' \
68 'git fast-import --export-marks=marks.out <input &&
69 git whatchanged master'
72 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
75 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
76 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
82 'git cat-file commit master | sed 1d >actual &&
83 test_cmp expect actual'
92 'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
93 test_cmp expect actual'
95 echo "$file2_data" >expect
98 'git cat-file blob master:file2 >actual && test_cmp expect actual'
100 echo "$file3_data" >expect
101 test_expect_success \
103 'git cat-file blob master:file3 >actual && test_cmp expect actual'
105 printf "$file4_data" >expect
106 test_expect_success \
108 'git cat-file blob master:file4 >actual && test_cmp expect actual'
111 object $(git rev-parse refs/heads/master)
115 An annotated tag without a tagger
117 test_expect_success
'A: verify tag/series-A' '
118 git cat-file tag tags/series-A >actual &&
119 test_cmp expect actual
123 :2 `git rev-parse --verify master:file2`
124 :3 `git rev-parse --verify master:file3`
125 :4 `git rev-parse --verify master:file4`
126 :5 `git rev-parse --verify master^0`
128 test_expect_success \
129 'A: verify marks output' \
130 'test_cmp expect marks.out'
132 test_expect_success \
133 'A: verify marks import' \
135 --import-marks=marks.out \
136 --export-marks=marks.new \
138 test_cmp expect marks.new'
141 cat >input
<<INPUT_END
142 commit refs/heads/verify--import-marks
143 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
149 M 755 :2 copy-of-file2
152 test_expect_success \
153 'A: verify marks import does not crash' \
154 'git fast-import --import-marks=marks.out <input &&
155 git whatchanged verify--import-marks'
156 test_expect_success \
158 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
160 :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
162 git diff-tree
-M -r master verify--import-marks
>actual
163 test_expect_success \
165 'compare_diff_raw expect actual &&
166 test `git rev-parse --verify master:file2` \
167 = `git rev-parse --verify verify--import-marks:copy-of-file2`'
174 cat >input
<<INPUT_END
175 commit refs/heads/branch
177 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
182 from refs/heads/master
183 M 755 0000000000000000000000000000000000000001 zero1
186 test_expect_success
'B: fail on invalid blob sha1' '
187 test_must_fail git fast-import <input
189 rm -f .git
/objects
/pack_
* .git
/objects
/index_
*
191 cat >input
<<INPUT_END
192 commit .badbranchname
193 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
198 from refs/heads/master
201 test_expect_success
'B: fail on invalid branch name ".badbranchname"' '
202 test_must_fail git fast-import <input
204 rm -f .git
/objects
/pack_
* .git
/objects
/index_
*
206 cat >input
<<INPUT_END
207 commit bad[branch]name
208 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
213 from refs/heads/master
216 test_expect_success
'B: fail on invalid branch name "bad[branch]name"' '
217 test_must_fail git fast-import <input
219 rm -f .git
/objects
/pack_
* .git
/objects
/index_
*
221 cat >input
<<INPUT_END
223 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
228 from refs/heads/master
231 test_expect_success \
232 'B: accept branch name "TEMP_TAG"' \
233 'git fast-import <input &&
234 test -f .git/TEMP_TAG &&
235 test `git rev-parse master` = `git rev-parse TEMP_TAG^`'
242 newf
=`echo hi newf | git hash-object -w --stdin`
243 oldf
=`git rev-parse --verify master:file2`
245 cat >input
<<INPUT_END
246 commit refs/heads/branch
247 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
252 from refs/heads/master
253 M 644 $oldf file2/oldf
254 M 755 $newf file2/newf
258 test_expect_success \
259 'C: incremental import create pack from stdin' \
260 'git fast-import <input &&
261 git whatchanged branch'
262 test_expect_success \
264 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
265 test_expect_success \
266 'C: validate reuse existing blob' \
267 'test $newf = `git rev-parse --verify branch:file2/newf`
268 test $oldf = `git rev-parse --verify branch:file2/oldf`'
271 parent `git rev-parse --verify master^0`
272 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
273 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
277 test_expect_success \
279 'git cat-file commit branch | sed 1d >actual &&
280 test_cmp expect actual'
283 :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
284 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
285 :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
287 git diff-tree
-M -r master branch
>actual
288 test_expect_success \
289 'C: validate rename result' \
290 'compare_diff_raw expect actual'
297 cat >input
<<INPUT_END
298 commit refs/heads/branch
299 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
304 from refs/heads/branch^0
305 M 644 inline newdir/interesting
310 M 755 inline newdir/exec.sh
316 test_expect_success \
317 'D: inline data in commit' \
318 'git fast-import <input &&
319 git whatchanged branch'
320 test_expect_success \
322 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
325 :000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A newdir/exec.sh
326 :000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A newdir/interesting
328 git diff-tree
-M -r branch^ branch
>actual
329 test_expect_success \
330 'D: validate new files added' \
331 'compare_diff_raw expect actual'
333 echo "$file5_data" >expect
334 test_expect_success \
336 'git cat-file blob branch:newdir/interesting >actual &&
337 test_cmp expect actual'
339 echo "$file6_data" >expect
340 test_expect_success \
342 'git cat-file blob branch:newdir/exec.sh >actual &&
343 test_cmp expect actual'
349 cat >input
<<INPUT_END
350 commit refs/heads/branch
351 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
352 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
357 from refs/heads/branch^0
360 test_expect_success
'E: rfc2822 date, --date-format=raw' '
361 test_must_fail git fast-import --date-format=raw <input
363 test_expect_success \
364 'E: rfc2822 date, --date-format=rfc2822' \
365 'git fast-import --date-format=rfc2822 <input'
366 test_expect_success \
368 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
371 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
372 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
376 test_expect_success \
378 'git cat-file commit branch | sed 1,2d >actual &&
379 test_cmp expect actual'
385 old_branch
=`git rev-parse --verify branch^0`
387 cat >input
<<INPUT_END
388 commit refs/heads/branch
389 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
391 losing things already?
394 from refs/heads/branch~1
396 reset refs/heads/other
397 from refs/heads/branch
400 test_expect_success \
401 'F: non-fast-forward update skips' \
402 'if git fast-import <input
404 echo BAD gfi did not fail
407 if test $old_branch = `git rev-parse --verify branch^0`
409 : branch unaffected and failure returned
412 echo BAD gfi changed branch $old_branch
417 test_expect_success \
419 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
422 tree `git rev-parse branch~1^{tree}`
423 parent `git rev-parse branch~1`
424 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
425 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
427 losing things already?
429 test_expect_success \
430 'F: verify other commit' \
431 'git cat-file commit other >actual &&
432 test_cmp expect actual'
438 old_branch
=`git rev-parse --verify branch^0`
440 cat >input
<<INPUT_END
441 commit refs/heads/branch
442 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
444 losing things already?
447 from refs/heads/branch~1
450 test_expect_success \
451 'G: non-fast-forward update forced' \
452 'git fast-import --force <input'
453 test_expect_success \
455 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
456 test_expect_success \
457 'G: branch changed, but logged' \
458 'test $old_branch != `git rev-parse --verify branch^0` &&
459 test $old_branch = `git rev-parse --verify branch@{1}`'
466 cat >input
<<INPUT_END
468 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
473 from refs/heads/branch^0
474 M 644 inline i-will-die
476 this file will never exist.
480 M 644 inline h/e/l/lo
486 test_expect_success \
487 'H: deletall, add 1' \
488 'git fast-import <input &&
490 test_expect_success \
492 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
495 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
496 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
497 :100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
498 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
499 :100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
501 git diff-tree
-M -r H^ H
>actual
502 test_expect_success \
503 'H: validate old files removed, new files added' \
504 'compare_diff_raw expect actual'
506 echo "$file5_data" >expect
507 test_expect_success \
509 'git cat-file blob H:h/e/l/lo >actual &&
510 test_cmp expect actual'
516 cat >input
<<INPUT_END
517 commit refs/heads/export-boundary
518 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
520 we have a border. its only 40 characters wide.
523 from refs/heads/branch
526 test_expect_success \
527 'I: export-pack-edges' \
528 'git fast-import --export-pack-edges=edges.list <input'
531 .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
533 test_expect_success \
534 'I: verify edge list' \
535 'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
536 test_cmp expect actual'
542 cat >input
<<INPUT_END
544 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
549 from refs/heads/branch
554 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
560 test_expect_success \
561 'J: reset existing branch creates empty commit' \
562 'git fast-import <input'
563 test_expect_success \
564 'J: branch has 1 commit, empty tree' \
565 'test 1 = `git rev-list J | wc -l` &&
566 test 0 = `git ls-tree J | wc -l`'
572 cat >input
<<INPUT_END
574 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
579 from refs/heads/branch
582 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
587 from refs/heads/branch^1
590 test_expect_success \
591 'K: reinit branch with from' \
592 'git fast-import <input'
593 test_expect_success \
594 'K: verify K^1 = branch^1' \
595 'test `git rev-parse --verify branch^1` \
596 = `git rev-parse --verify K^1`'
602 cat >input
<<INPUT_END
616 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
626 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
636 cat >expect
<<EXPECT_END
637 :100644 100644 4268632... 55d3a52... M b.
638 :040000 040000 0ae5cac... 443c768... M b
639 :100644 100644 4268632... 55d3a52... M ba
642 test_expect_success \
643 'L: verify internal tree sorting' \
644 'git fast-import <input &&
645 git diff-tree --abbrev --raw L^ L >output &&
646 test_cmp expect output'
653 cat >input
<<INPUT_END
655 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
660 from refs/heads/branch^0
661 R file2/newf file2/n.e.w.f
666 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
668 test_expect_success \
669 'M: rename file in same subdirectory' \
670 'git fast-import <input &&
671 git diff-tree -M -r M1^ M1 >actual &&
672 compare_diff_raw expect actual'
674 cat >input
<<INPUT_END
676 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
681 from refs/heads/branch^0
682 R file2/newf i/am/new/to/you
687 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
689 test_expect_success \
690 'M: rename file to new subdirectory' \
691 'git fast-import <input &&
692 git diff-tree -M -r M2^ M2 >actual &&
693 compare_diff_raw expect actual'
695 cat >input
<<INPUT_END
697 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
708 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
710 test_expect_success \
711 'M: rename subdirectory to new subdirectory' \
712 'git fast-import <input &&
713 git diff-tree -M -r M3^ M3 >actual &&
714 compare_diff_raw expect actual'
721 cat >input
<<INPUT_END
723 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
728 from refs/heads/branch^0
729 C file2/newf file2/n.e.w.f
734 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
736 test_expect_success \
737 'N: copy file in same subdirectory' \
738 'git fast-import <input &&
739 git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
740 compare_diff_raw expect actual'
742 cat >input
<<INPUT_END
744 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
749 from refs/heads/branch^0
753 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
755 modify directory copy
758 M 644 inline file3/file5
766 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
767 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
768 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
770 test_expect_success \
771 'N: copy then modify subdirectory' \
772 'git fast-import <input &&
773 git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
774 compare_diff_raw expect actual'
776 cat >input
<<INPUT_END
778 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
783 from refs/heads/branch^0
784 M 644 inline file2/file5
794 test_expect_success \
795 'N: copy dirty subdirectory' \
796 'git fast-import <input &&
797 test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`'
803 cat >input
<<INPUT_END
806 # -- ignore all of this text
807 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
808 # $GIT_COMMITTER_NAME has inserted here for his benefit.
813 # don't forget the import blank line!
815 # yes, we started from our usual base of branch^0.
817 from refs/heads/branch^0
818 # and we need to reuse file2/file5 from N3 above.
819 M 644 inline file2/file5
820 # otherwise the tree will be different
825 # don't forget to copy file2 to file3
828 # or to delete file5 from file2.
834 test_expect_success \
835 'O: comments are all skipped' \
836 'git fast-import <input &&
837 test `git rev-parse N3` = `git rev-parse O1`'
839 cat >input
<<INPUT_END
841 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
845 from refs/heads/branch^0
846 M 644 inline file2/file5
855 test_expect_success \
856 'O: blank lines not necessary after data commands' \
857 'git fast-import <input &&
858 test `git rev-parse N3` = `git rev-parse O2`'
860 test_expect_success \
861 'O: repack before next test' \
864 cat >input
<<INPUT_END
866 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
871 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
878 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
884 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
888 reset refs/tags/O3-2nd
890 reset refs/tags/O3-3rd
894 cat >expect
<<INPUT_END
900 test_expect_success \
901 'O: blank lines not necessary after other commands' \
902 'git fast-import <input &&
903 test 8 = `find .git/objects/pack -type f | wc -l` &&
904 test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
905 git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
906 test_cmp expect actual'
908 cat >input
<<INPUT_END
910 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
915 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
919 progress Two commits down, 2 to go!
921 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
925 progress Three commits down, 1 to go!
927 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
933 test_expect_success \
934 'O: progress outputs as requested by input' \
935 'git fast-import <input >actual &&
936 grep "progress " <input >expect &&
937 test_cmp expect actual'
940 ### series P (gitlinks)
943 cat >input
<<INPUT_END
950 commit refs/heads/sub
952 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
965 commit refs/heads/subuse1
967 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
970 from refs/heads/master
971 M 100644 :3 .gitmodules
980 commit refs/heads/sub
982 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
988 commit refs/heads/subuse1
990 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
998 test_expect_success \
999 'P: supermodule & submodule mix' \
1000 'git fast-import <input &&
1001 git checkout subuse1 &&
1002 rm -rf sub && mkdir sub && cd sub &&
1004 git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
1005 git checkout master &&
1007 git submodule init &&
1008 git submodule update'
1010 SUBLAST
=$
(git rev-parse
--verify sub
)
1011 SUBPREV
=$
(git rev-parse
--verify sub^
)
1013 cat >input
<<INPUT_END
1022 commit refs/heads/subuse2
1024 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1027 from refs/heads/master
1028 M 100644 :1 .gitmodules
1029 M 160000 $SUBPREV sub
1031 commit refs/heads/subuse2
1033 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1037 M 160000 $SUBLAST sub
1041 test_expect_success \
1042 'P: verbatim SHA gitlinks' \
1043 'git branch -D sub &&
1044 git gc && git prune &&
1045 git fast-import <input &&
1046 test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)'
1049 cat >input
<<INPUT_END
1050 commit refs/heads/subuse3
1052 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1057 from refs/heads/subuse2
1065 test_expect_success
'P: fail on inline gitlink' '
1066 test_must_fail git fast-import <input'
1069 cat >input
<<INPUT_END
1076 commit refs/heads/subuse3
1078 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1083 from refs/heads/subuse2
1088 test_expect_success
'P: fail on blob mark in gitlink' '
1089 test_must_fail git fast-import <input'
1092 ### series Q (notes)
1095 note1_data
="Note for the first commit"
1096 note2_data
="Note for the second commit"
1097 note3_data
="Note for the third commit"
1100 cat >input
<<INPUT_END
1107 commit refs/heads/notes-test
1109 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1120 commit refs/heads/notes-test
1122 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1129 commit refs/heads/notes-test
1131 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1158 commit refs/notes/foobar
1160 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1173 test_expect_success \
1175 'git fast-import <input &&
1176 git whatchanged notes-test'
1177 test_expect_success \
1179 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
1181 commit1
=$
(git rev-parse notes-test~
2)
1182 commit2
=$
(git rev-parse notes-test^
)
1183 commit3
=$
(git rev-parse notes-test
)
1186 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1187 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1191 test_expect_success \
1192 'Q: verify first commit' \
1193 'git cat-file commit notes-test~2 | sed 1d >actual &&
1194 test_cmp expect actual'
1198 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1199 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1203 test_expect_success \
1204 'Q: verify second commit' \
1205 'git cat-file commit notes-test^ | sed 1d >actual &&
1206 test_cmp expect actual'
1210 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1211 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1215 test_expect_success \
1216 'Q: verify third commit' \
1217 'git cat-file commit notes-test | sed 1d >actual &&
1218 test_cmp expect actual'
1221 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1222 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1226 test_expect_success \
1227 'Q: verify notes commit' \
1228 'git cat-file commit refs/notes/foobar | sed 1d >actual &&
1229 test_cmp expect actual'
1231 cat >expect.unsorted
<<EOF
1232 100644 blob $commit1
1233 100644 blob $commit2
1234 100644 blob $commit3
1236 cat expect.unsorted |
sort >expect
1237 test_expect_success \
1238 'Q: verify notes tree' \
1239 'git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1240 test_cmp expect actual'
1242 echo "$note1_data" >expect
1243 test_expect_success \
1244 'Q: verify note for first commit' \
1245 'git cat-file blob refs/notes/foobar:$commit1 >actual && test_cmp expect actual'
1247 echo "$note2_data" >expect
1248 test_expect_success \
1249 'Q: verify note for second commit' \
1250 'git cat-file blob refs/notes/foobar:$commit2 >actual && test_cmp expect actual'
1252 echo "$note3_data" >expect
1253 test_expect_success \
1254 'Q: verify note for third commit' \
1255 'git cat-file blob refs/notes/foobar:$commit3 >actual && test_cmp expect actual'