84
84
test_expect_success \
86
'git-cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
86
'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
87
87
git diff expect actual'
89
89
echo "$file2_data" >expect
90
90
test_expect_success \
91
91
'A: verify file2' \
92
'git-cat-file blob master:file2 >actual && git diff expect actual'
92
'git cat-file blob master:file2 >actual && git diff expect actual'
94
94
echo "$file3_data" >expect
95
95
test_expect_success \
96
96
'A: verify file3' \
97
'git-cat-file blob master:file3 >actual && git diff expect actual'
97
'git cat-file blob master:file3 >actual && git diff expect actual'
99
99
printf "$file4_data" >expect
100
100
test_expect_success \
101
101
'A: verify file4' \
102
'git-cat-file blob master:file4 >actual && git diff expect actual'
102
'git cat-file blob master:file4 >actual && git diff expect actual'
104
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`
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
110
test_expect_success \
111
111
'A: verify marks output' \
134
134
test_expect_success \
135
135
'A: verify marks import does not crash' \
136
136
'git-fast-import --import-marks=marks.out <input &&
137
git-whatchanged verify--import-marks'
137
git whatchanged verify--import-marks'
138
138
test_expect_success \
139
139
'A: verify pack' \
140
'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done'
140
'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
141
141
cat >expect <<EOF
142
142
:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
144
git-diff-tree -M -r master verify--import-marks >actual
144
git diff-tree -M -r master verify--import-marks >actual
145
145
test_expect_success \
146
146
'A: verify diff' \
147
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`'
148
test `git rev-parse --verify master:file2` \
149
= `git rev-parse --verify verify--import-marks:copy-of-file2`'
170
170
'git-fast-import <input'
171
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
180
from refs/heads/master
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
195
from refs/heads/master
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
205
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
210
from refs/heads/master
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^`'
177
224
newf=`echo hi newf | git-hash-object -w --stdin`
178
oldf=`git-rev-parse --verify master:file2`
225
oldf=`git rev-parse --verify master:file2`
180
227
cat >input <<INPUT_END
181
228
commit refs/heads/branch
193
240
test_expect_success \
194
241
'C: incremental import create pack from stdin' \
195
242
'git-fast-import <input &&
196
git-whatchanged branch'
243
git whatchanged branch'
197
244
test_expect_success \
198
245
'C: verify pack' \
199
'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done'
246
'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
200
247
test_expect_success \
201
248
'C: validate reuse existing blob' \
202
'test $newf = `git-rev-parse --verify branch:file2/newf`
203
test $oldf = `git-rev-parse --verify branch:file2/oldf`'
249
'test $newf = `git rev-parse --verify branch:file2/newf`
250
test $oldf = `git rev-parse --verify branch:file2/oldf`'
205
252
cat >expect <<EOF
206
parent `git-rev-parse --verify master^0`
253
parent `git rev-parse --verify master^0`
207
254
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
208
255
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
577
624
test_expect_success \
578
625
'L: verify internal tree sorting' \
579
626
'git-fast-import <input &&
580
git-diff --raw L^ L >output &&
627
git diff-tree --abbrev --raw L^ L >output &&
581
628
git diff expect output'
635
cat >input <<INPUT_END
637
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
642
from refs/heads/branch^0
643
R file2/newf file2/n.e.w.f
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
658
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
663
from refs/heads/branch^0
664
R file2/newf i/am/new/to/you
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
679
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
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'
703
cat >input <<INPUT_END
705
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
710
from refs/heads/branch^0
711
C file2/newf file2/n.e.w.f
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
726
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
731
from refs/heads/branch^0
735
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
737
modify directory copy
740
M 644 inline file3/file5
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
760
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
765
from refs/heads/branch^0
766
M 644 inline file2/file5
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}`'
785
cat >input <<INPUT_END
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.
795
# don't forget the import blank line!
797
# yes, we started from our usual base of 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
807
# don't forget to copy file2 to file3
810
# or to delete file5 from file2.
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
823
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
827
from refs/heads/branch^0
828
M 644 inline file2/file5
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' \
846
cat >input <<INPUT_END
848
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
853
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
860
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
866
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
870
reset refs/tags/O3-2nd
874
cat >expect <<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
890
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
895
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
899
progress Two commits down, 2 to go!
901
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
905
progress Three commits down, 1 to go!
907
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
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'