instaweb: use 'browser.<tool>.path' config option if it's set.
[git/dscho.git] / t / t9300-fast-import.sh
blob0595041af5d310f905306c6a289945cde26d88fc
1 #!/bin/sh
3 # Copyright (c) 2007 Shawn Pearce
6 test_description='test git-fast-import utility'
7 . ./test-lib.sh
8 . ../diff-lib.sh ;# test-lib chdir's into trash
10 file2_data='file2
11 second line of EOF'
13 file3_data='EOF
14 in 3rd file
15 END'
17 file4_data=abcd
18 file4_len=4
20 file5_data='an inline file.
21 we should see it later.'
23 file6_data='#!/bin/sh
24 echo "$@"'
26 ###
27 ### series A
28 ###
30 test_tick
31 cat >input <<INPUT_END
32 blob
33 mark :2
34 data <<EOF
35 $file2_data
36 EOF
38 blob
39 mark :3
40 data <<END
41 $file3_data
42 END
44 blob
45 mark :4
46 data $file4_len
47 $file4_data
48 commit refs/heads/master
49 mark :5
50 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
51 data <<COMMIT
52 initial
53 COMMIT
55 M 644 :2 file2
56 M 644 :3 file3
57 M 755 :4 file4
59 INPUT_END
60 test_expect_success \
61 'A: create pack from stdin' \
62 'git-fast-import --export-marks=marks.out <input &&
63 git whatchanged master'
64 test_expect_success \
65 'A: verify pack' \
66 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
68 cat >expect <<EOF
69 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
70 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
72 initial
73 EOF
74 test_expect_success \
75 'A: verify commit' \
76 'git cat-file commit master | sed 1d >actual &&
77 git diff expect actual'
79 cat >expect <<EOF
80 100644 blob file2
81 100644 blob file3
82 100755 blob file4
83 EOF
84 test_expect_success \
85 'A: verify tree' \
86 'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
87 git diff expect actual'
89 echo "$file2_data" >expect
90 test_expect_success \
91 'A: verify file2' \
92 'git cat-file blob master:file2 >actual && git diff expect actual'
94 echo "$file3_data" >expect
95 test_expect_success \
96 'A: verify file3' \
97 'git cat-file blob master:file3 >actual && git diff expect actual'
99 printf "$file4_data" >expect
100 test_expect_success \
101 'A: verify file4' \
102 'git cat-file blob master:file4 >actual && git diff expect actual'
104 cat >expect <<EOF
105 :2 `git rev-parse --verify master:file2`
106 :3 `git rev-parse --verify master:file3`
107 :4 `git rev-parse --verify master:file4`
108 :5 `git rev-parse --verify master^0`
110 test_expect_success \
111 'A: verify marks output' \
112 'git diff expect marks.out'
114 test_expect_success \
115 'A: verify marks import' \
116 'git-fast-import \
117 --import-marks=marks.out \
118 --export-marks=marks.new \
119 </dev/null &&
120 git diff -u expect marks.new'
122 test_tick
123 cat >input <<INPUT_END
124 commit refs/heads/verify--import-marks
125 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
126 data <<COMMIT
127 recreate from :5
128 COMMIT
130 from :5
131 M 755 :2 copy-of-file2
133 INPUT_END
134 test_expect_success \
135 'A: verify marks import does not crash' \
136 'git-fast-import --import-marks=marks.out <input &&
137 git whatchanged verify--import-marks'
138 test_expect_success \
139 'A: verify pack' \
140 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
141 cat >expect <<EOF
142 :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
144 git diff-tree -M -r master verify--import-marks >actual
145 test_expect_success \
146 'A: verify diff' \
147 'compare_diff_raw expect actual &&
148 test `git rev-parse --verify master:file2` \
149 = `git rev-parse --verify verify--import-marks:copy-of-file2`'
152 ### series B
155 test_tick
156 cat >input <<INPUT_END
157 commit refs/heads/branch
158 mark :1
159 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
160 data <<COMMIT
161 corrupt
162 COMMIT
164 from refs/heads/master
165 M 755 0000000000000000000000000000000000000001 zero1
167 INPUT_END
168 test_expect_failure \
169 'B: fail on invalid blob sha1' \
170 'git-fast-import <input'
171 rm -f .git/objects/pack_* .git/objects/index_*
173 cat >input <<INPUT_END
174 commit .badbranchname
175 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
176 data <<COMMIT
177 corrupt
178 COMMIT
180 from refs/heads/master
182 INPUT_END
183 test_expect_failure \
184 'B: fail on invalid branch name ".badbranchname"' \
185 'git-fast-import <input'
186 rm -f .git/objects/pack_* .git/objects/index_*
188 cat >input <<INPUT_END
189 commit bad[branch]name
190 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
191 data <<COMMIT
192 corrupt
193 COMMIT
195 from refs/heads/master
197 INPUT_END
198 test_expect_failure \
199 'B: fail on invalid branch name "bad[branch]name"' \
200 'git-fast-import <input'
201 rm -f .git/objects/pack_* .git/objects/index_*
203 cat >input <<INPUT_END
204 commit TEMP_TAG
205 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
206 data <<COMMIT
207 tag base
208 COMMIT
210 from refs/heads/master
212 INPUT_END
213 test_expect_success \
214 'B: accept branch name "TEMP_TAG"' \
215 'git-fast-import <input &&
216 test -f .git/TEMP_TAG &&
217 test `git rev-parse master` = `git rev-parse TEMP_TAG^`'
218 rm -f .git/TEMP_TAG
221 ### series C
224 newf=`echo hi newf | git-hash-object -w --stdin`
225 oldf=`git rev-parse --verify master:file2`
226 test_tick
227 cat >input <<INPUT_END
228 commit refs/heads/branch
229 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
230 data <<COMMIT
231 second
232 COMMIT
234 from refs/heads/master
235 M 644 $oldf file2/oldf
236 M 755 $newf file2/newf
237 D file3
239 INPUT_END
240 test_expect_success \
241 'C: incremental import create pack from stdin' \
242 'git-fast-import <input &&
243 git whatchanged branch'
244 test_expect_success \
245 'C: verify pack' \
246 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
247 test_expect_success \
248 'C: validate reuse existing blob' \
249 'test $newf = `git rev-parse --verify branch:file2/newf`
250 test $oldf = `git rev-parse --verify branch:file2/oldf`'
252 cat >expect <<EOF
253 parent `git rev-parse --verify master^0`
254 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
255 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
257 second
259 test_expect_success \
260 'C: verify commit' \
261 'git cat-file commit branch | sed 1d >actual &&
262 git diff expect actual'
264 cat >expect <<EOF
265 :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
266 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
267 :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
269 git diff-tree -M -r master branch >actual
270 test_expect_success \
271 'C: validate rename result' \
272 'compare_diff_raw expect actual'
275 ### series D
278 test_tick
279 cat >input <<INPUT_END
280 commit refs/heads/branch
281 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
282 data <<COMMIT
283 third
284 COMMIT
286 from refs/heads/branch^0
287 M 644 inline newdir/interesting
288 data <<EOF
289 $file5_data
292 M 755 inline newdir/exec.sh
293 data <<EOF
294 $file6_data
297 INPUT_END
298 test_expect_success \
299 'D: inline data in commit' \
300 'git-fast-import <input &&
301 git whatchanged branch'
302 test_expect_success \
303 'D: verify pack' \
304 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
306 cat >expect <<EOF
307 :000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A newdir/exec.sh
308 :000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A newdir/interesting
310 git diff-tree -M -r branch^ branch >actual
311 test_expect_success \
312 'D: validate new files added' \
313 'compare_diff_raw expect actual'
315 echo "$file5_data" >expect
316 test_expect_success \
317 'D: verify file5' \
318 'git cat-file blob branch:newdir/interesting >actual &&
319 git diff expect actual'
321 echo "$file6_data" >expect
322 test_expect_success \
323 'D: verify file6' \
324 'git cat-file blob branch:newdir/exec.sh >actual &&
325 git diff expect actual'
328 ### series E
331 cat >input <<INPUT_END
332 commit refs/heads/branch
333 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
334 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
335 data <<COMMIT
336 RFC 2822 type date
337 COMMIT
339 from refs/heads/branch^0
341 INPUT_END
342 test_expect_failure \
343 'E: rfc2822 date, --date-format=raw' \
344 'git-fast-import --date-format=raw <input'
345 test_expect_success \
346 'E: rfc2822 date, --date-format=rfc2822' \
347 'git-fast-import --date-format=rfc2822 <input'
348 test_expect_success \
349 'E: verify pack' \
350 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
352 cat >expect <<EOF
353 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
354 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
356 RFC 2822 type date
358 test_expect_success \
359 'E: verify commit' \
360 'git cat-file commit branch | sed 1,2d >actual &&
361 git diff expect actual'
364 ### series F
367 old_branch=`git rev-parse --verify branch^0`
368 test_tick
369 cat >input <<INPUT_END
370 commit refs/heads/branch
371 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
372 data <<COMMIT
373 losing things already?
374 COMMIT
376 from refs/heads/branch~1
378 reset refs/heads/other
379 from refs/heads/branch
381 INPUT_END
382 test_expect_success \
383 'F: non-fast-forward update skips' \
384 'if git-fast-import <input
385 then
386 echo BAD gfi did not fail
387 return 1
388 else
389 if test $old_branch = `git rev-parse --verify branch^0`
390 then
391 : branch unaffected and failure returned
392 return 0
393 else
394 echo BAD gfi changed branch $old_branch
395 return 1
399 test_expect_success \
400 'F: verify pack' \
401 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
403 cat >expect <<EOF
404 tree `git rev-parse branch~1^{tree}`
405 parent `git rev-parse branch~1`
406 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
407 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
409 losing things already?
411 test_expect_success \
412 'F: verify other commit' \
413 'git cat-file commit other >actual &&
414 git diff expect actual'
417 ### series G
420 old_branch=`git rev-parse --verify branch^0`
421 test_tick
422 cat >input <<INPUT_END
423 commit refs/heads/branch
424 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
425 data <<COMMIT
426 losing things already?
427 COMMIT
429 from refs/heads/branch~1
431 INPUT_END
432 test_expect_success \
433 'G: non-fast-forward update forced' \
434 'git-fast-import --force <input'
435 test_expect_success \
436 'G: verify pack' \
437 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
438 test_expect_success \
439 'G: branch changed, but logged' \
440 'test $old_branch != `git rev-parse --verify branch^0` &&
441 test $old_branch = `git rev-parse --verify branch@{1}`'
444 ### series H
447 test_tick
448 cat >input <<INPUT_END
449 commit refs/heads/H
450 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
451 data <<COMMIT
452 third
453 COMMIT
455 from refs/heads/branch^0
456 M 644 inline i-will-die
457 data <<EOF
458 this file will never exist.
461 deleteall
462 M 644 inline h/e/l/lo
463 data <<EOF
464 $file5_data
467 INPUT_END
468 test_expect_success \
469 'H: deletall, add 1' \
470 'git-fast-import <input &&
471 git whatchanged H'
472 test_expect_success \
473 'H: verify pack' \
474 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
476 cat >expect <<EOF
477 :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
478 :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
479 :100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
480 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
481 :100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
483 git diff-tree -M -r H^ H >actual
484 test_expect_success \
485 'H: validate old files removed, new files added' \
486 'compare_diff_raw expect actual'
488 echo "$file5_data" >expect
489 test_expect_success \
490 'H: verify file' \
491 'git cat-file blob H:h/e/l/lo >actual &&
492 git diff expect actual'
495 ### series I
498 cat >input <<INPUT_END
499 commit refs/heads/export-boundary
500 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
501 data <<COMMIT
502 we have a border. its only 40 characters wide.
503 COMMIT
505 from refs/heads/branch
507 INPUT_END
508 test_expect_success \
509 'I: export-pack-edges' \
510 'git-fast-import --export-pack-edges=edges.list <input'
512 cat >expect <<EOF
513 .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
515 test_expect_success \
516 'I: verify edge list' \
517 'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
518 git diff expect actual'
521 ### series J
524 cat >input <<INPUT_END
525 commit refs/heads/J
526 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
527 data <<COMMIT
528 create J
529 COMMIT
531 from refs/heads/branch
533 reset refs/heads/J
535 commit refs/heads/J
536 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
537 data <<COMMIT
538 initialize J
539 COMMIT
541 INPUT_END
542 test_expect_success \
543 'J: reset existing branch creates empty commit' \
544 'git-fast-import <input'
545 test_expect_success \
546 'J: branch has 1 commit, empty tree' \
547 'test 1 = `git rev-list J | wc -l` &&
548 test 0 = `git ls-tree J | wc -l`'
551 ### series K
554 cat >input <<INPUT_END
555 commit refs/heads/K
556 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
557 data <<COMMIT
558 create K
559 COMMIT
561 from refs/heads/branch
563 commit refs/heads/K
564 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
565 data <<COMMIT
566 redo K
567 COMMIT
569 from refs/heads/branch^1
571 INPUT_END
572 test_expect_success \
573 'K: reinit branch with from' \
574 'git-fast-import <input'
575 test_expect_success \
576 'K: verify K^1 = branch^1' \
577 'test `git rev-parse --verify branch^1` \
578 = `git rev-parse --verify K^1`'
581 ### series L
584 cat >input <<INPUT_END
585 blob
586 mark :1
587 data <<EOF
588 some data
591 blob
592 mark :2
593 data <<EOF
594 other data
597 commit refs/heads/L
598 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
599 data <<COMMIT
600 create L
601 COMMIT
603 M 644 :1 b.
604 M 644 :1 b/other
605 M 644 :1 ba
607 commit refs/heads/L
608 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
609 data <<COMMIT
610 update L
611 COMMIT
613 M 644 :2 b.
614 M 644 :2 b/other
615 M 644 :2 ba
616 INPUT_END
618 cat >expect <<EXPECT_END
619 :100644 100644 4268632... 55d3a52... M b.
620 :040000 040000 0ae5cac... 443c768... M b
621 :100644 100644 4268632... 55d3a52... M ba
622 EXPECT_END
624 test_expect_success \
625 'L: verify internal tree sorting' \
626 'git-fast-import <input &&
627 git diff-tree --abbrev --raw L^ L >output &&
628 git diff expect output'
631 ### series M
634 test_tick
635 cat >input <<INPUT_END
636 commit refs/heads/M1
637 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
638 data <<COMMIT
639 file rename
640 COMMIT
642 from refs/heads/branch^0
643 R file2/newf file2/n.e.w.f
645 INPUT_END
647 cat >expect <<EOF
648 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
650 test_expect_success \
651 'M: rename file in same subdirectory' \
652 'git-fast-import <input &&
653 git diff-tree -M -r M1^ M1 >actual &&
654 compare_diff_raw expect actual'
656 cat >input <<INPUT_END
657 commit refs/heads/M2
658 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
659 data <<COMMIT
660 file rename
661 COMMIT
663 from refs/heads/branch^0
664 R file2/newf i/am/new/to/you
666 INPUT_END
668 cat >expect <<EOF
669 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
671 test_expect_success \
672 'M: rename file to new subdirectory' \
673 'git-fast-import <input &&
674 git diff-tree -M -r M2^ M2 >actual &&
675 compare_diff_raw expect actual'
677 cat >input <<INPUT_END
678 commit refs/heads/M3
679 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
680 data <<COMMIT
681 file rename
682 COMMIT
684 from refs/heads/M2^0
685 R i other/sub
687 INPUT_END
689 cat >expect <<EOF
690 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
692 test_expect_success \
693 'M: rename subdirectory to new subdirectory' \
694 'git-fast-import <input &&
695 git diff-tree -M -r M3^ M3 >actual &&
696 compare_diff_raw expect actual'
699 ### series N
702 test_tick
703 cat >input <<INPUT_END
704 commit refs/heads/N1
705 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
706 data <<COMMIT
707 file copy
708 COMMIT
710 from refs/heads/branch^0
711 C file2/newf file2/n.e.w.f
713 INPUT_END
715 cat >expect <<EOF
716 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
718 test_expect_success \
719 'N: copy file in same subdirectory' \
720 'git-fast-import <input &&
721 git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
722 compare_diff_raw expect actual'
724 cat >input <<INPUT_END
725 commit refs/heads/N2
726 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
727 data <<COMMIT
728 clean directory copy
729 COMMIT
731 from refs/heads/branch^0
732 C file2 file3
734 commit refs/heads/N2
735 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
736 data <<COMMIT
737 modify directory copy
738 COMMIT
740 M 644 inline file3/file5
741 data <<EOF
742 $file5_data
745 INPUT_END
747 cat >expect <<EOF
748 :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
749 :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
750 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
752 test_expect_success \
753 'N: copy then modify subdirectory' \
754 'git-fast-import <input &&
755 git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
756 compare_diff_raw expect actual'
758 cat >input <<INPUT_END
759 commit refs/heads/N3
760 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
761 data <<COMMIT
762 dirty directory copy
763 COMMIT
765 from refs/heads/branch^0
766 M 644 inline file2/file5
767 data <<EOF
768 $file5_data
771 C file2 file3
772 D file2/file5
774 INPUT_END
776 test_expect_success \
777 'N: copy dirty subdirectory' \
778 'git-fast-import <input &&
779 test `git-rev-parse N2^{tree}` = `git-rev-parse N3^{tree}`'
782 ### series O
785 cat >input <<INPUT_END
786 #we will
787 commit refs/heads/O1
788 # -- ignore all of this text
789 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
790 # $GIT_COMMITTER_NAME has inserted here for his benefit.
791 data <<COMMIT
792 dirty directory copy
793 COMMIT
795 # don't forget the import blank line!
797 # yes, we started from our usual base of branch^0.
798 # i like branch^0.
799 from refs/heads/branch^0
800 # and we need to reuse file2/file5 from N3 above.
801 M 644 inline file2/file5
802 # otherwise the tree will be different
803 data <<EOF
804 $file5_data
807 # don't forget to copy file2 to file3
808 C file2 file3
810 # or to delete file5 from file2.
811 D file2/file5
812 # are we done yet?
814 INPUT_END
816 test_expect_success \
817 'O: comments are all skipped' \
818 'git-fast-import <input &&
819 test `git-rev-parse N3` = `git-rev-parse O1`'
821 cat >input <<INPUT_END
822 commit refs/heads/O2
823 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
824 data <<COMMIT
825 dirty directory copy
826 COMMIT
827 from refs/heads/branch^0
828 M 644 inline file2/file5
829 data <<EOF
830 $file5_data
832 C file2 file3
833 D file2/file5
835 INPUT_END
837 test_expect_success \
838 'O: blank lines not necessary after data commands' \
839 'git-fast-import <input &&
840 test `git-rev-parse N3` = `git-rev-parse O2`'
842 test_expect_success \
843 'O: repack before next test' \
844 'git repack -a -d'
846 cat >input <<INPUT_END
847 commit refs/heads/O3
848 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
849 data <<COMMIT
850 zstring
851 COMMIT
852 commit refs/heads/O3
853 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
854 data <<COMMIT
856 COMMIT
857 checkpoint
858 commit refs/heads/O3
859 mark :5
860 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
861 data <<COMMIT
862 zempty
863 COMMIT
864 checkpoint
865 commit refs/heads/O3
866 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
867 data <<COMMIT
868 zcommits
869 COMMIT
870 reset refs/tags/O3-2nd
871 from :5
872 INPUT_END
874 cat >expect <<INPUT_END
875 string
877 empty
878 commits
879 INPUT_END
880 test_expect_success \
881 'O: blank lines not necessary after other commands' \
882 'git-fast-import <input &&
883 test 8 = `find .git/objects/pack -type f | wc -l` &&
884 test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
885 git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
886 git diff expect actual'
888 cat >input <<INPUT_END
889 commit refs/heads/O4
890 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
891 data <<COMMIT
892 zstring
893 COMMIT
894 commit refs/heads/O4
895 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
896 data <<COMMIT
898 COMMIT
899 progress Two commits down, 2 to go!
900 commit refs/heads/O4
901 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
902 data <<COMMIT
903 zempty
904 COMMIT
905 progress Three commits down, 1 to go!
906 commit refs/heads/O4
907 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
908 data <<COMMIT
909 zcommits
910 COMMIT
911 progress I'm done!
912 INPUT_END
913 test_expect_success \
914 'O: progress outputs as requested by input' \
915 'git-fast-import <input >actual &&
916 grep "progress " <input >expect &&
917 git diff expect actual'
919 test_done