3 # Copyright (c) 2007 Shawn Pearce
6 test_description='test git-fast-import utility'
8 . ../diff-lib.sh ;# test-lib chdir's into trash
15 cat >input <<INPUT_END
35 commit refs/heads/master
37 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
48 'A: create pack from stdin' \
49 'git-fast-import --export-marks=marks.out <input &&
50 git-whatchanged master'
53 'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done'
56 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
57 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
63 'git-cat-file commit master | sed 1d >actual &&
64 diff -u expect actual'
73 'git-cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
74 diff -u expect actual'
82 'git-cat-file blob master:file2 >actual && diff -u expect actual'
91 'git-cat-file blob master:file3 >actual && diff -u expect actual'
96 'git-cat-file blob master:file4 >actual && diff -u expect actual'
99 :2 `git-rev-parse --verify master:file2`
100 :3 `git-rev-parse --verify master:file3`
101 :4 `git-rev-parse --verify master:file4`
102 :5 `git-rev-parse --verify master^0`
104 test_expect_success \
105 'A: verify marks output' \
106 'diff -u expect marks.out'
113 cat >input <<INPUT_END
114 commit refs/heads/branch
116 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
121 from refs/heads/master
122 M 755 0000000000000000000000000000000000000001 zero1
125 test_expect_failure \
126 'B: fail on invalid blob sha1' \
127 'git-fast-import <input'
128 rm -f .git/objects/pack_* .git/objects/index_*
134 newf=`echo hi newf | git-hash-object -w --stdin`
135 oldf=`git-rev-parse --verify master:file2`
137 cat >input <<INPUT_END
138 commit refs/heads/branch
139 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
144 from refs/heads/master
145 M 644 $oldf file2/oldf
146 M 755 $newf file2/newf
150 test_expect_success \
151 'C: incremental import create pack from stdin' \
152 'git-fast-import <input &&
153 git-whatchanged branch'
154 test_expect_success \
156 'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done'
157 test_expect_success \
158 'C: validate reuse existing blob' \
159 'test $newf = `git-rev-parse --verify branch:file2/newf`
160 test $oldf = `git-rev-parse --verify branch:file2/oldf`'
163 parent `git-rev-parse --verify master^0`
164 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
165 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
169 test_expect_success \
171 'git-cat-file commit branch | sed 1d >actual &&
172 diff -u expect actual'
175 :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
176 :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
177 :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
179 git-diff-tree -M -r master branch >actual
180 test_expect_success \
181 'C: validate rename result' \
182 'compare_diff_raw expect actual'