]>
Commit | Line | Data |
---|---|---|
50aee995 SP |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2007 Shawn Pearce | |
4 | # | |
5 | ||
eaa2a6fc | 6 | test_description='test git fast-import utility' |
50aee995 | 7 | . ./test-lib.sh |
bfdbee98 | 8 | . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash |
50aee995 | 9 | |
8232dc42 SP |
10 | file2_data='file2 |
11 | second line of EOF' | |
12 | ||
13 | file3_data='EOF | |
14 | in 3rd file | |
15 | END' | |
16 | ||
17 | file4_data=abcd | |
18 | file4_len=4 | |
19 | ||
b715cfbb SP |
20 | file5_data='an inline file. |
21 | we should see it later.' | |
22 | ||
23 | file6_data='#!/bin/sh | |
24 | echo "$@"' | |
25 | ||
50aee995 SP |
26 | ### |
27 | ### series A | |
28 | ### | |
29 | ||
30 | test_tick | |
31 | cat >input <<INPUT_END | |
32 | blob | |
33 | mark :2 | |
34 | data <<EOF | |
8232dc42 | 35 | $file2_data |
50aee995 SP |
36 | EOF |
37 | ||
38 | blob | |
39 | mark :3 | |
40 | data <<END | |
8232dc42 | 41 | $file3_data |
50aee995 SP |
42 | END |
43 | ||
44 | blob | |
45 | mark :4 | |
8232dc42 SP |
46 | data $file4_len |
47 | $file4_data | |
50aee995 SP |
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 | |
54 | ||
55 | M 644 :2 file2 | |
56 | M 644 :3 file3 | |
57 | M 755 :4 file4 | |
58 | ||
88fbf67b JH |
59 | tag series-A |
60 | from :5 | |
61 | data <<EOF | |
62 | An annotated tag without a tagger | |
63 | EOF | |
64 | ||
50aee995 SP |
65 | INPUT_END |
66 | test_expect_success \ | |
67 | 'A: create pack from stdin' \ | |
eaa2a6fc | 68 | 'git fast-import --export-marks=marks.out <input && |
5be60078 | 69 | git whatchanged master' |
50aee995 SP |
70 | test_expect_success \ |
71 | 'A: verify pack' \ | |
5be60078 | 72 | 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' |
50aee995 SP |
73 | |
74 | cat >expect <<EOF | |
75 | author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
76 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
77 | ||
78 | initial | |
79 | EOF | |
80 | test_expect_success \ | |
81 | 'A: verify commit' \ | |
5be60078 | 82 | 'git cat-file commit master | sed 1d >actual && |
3af82863 | 83 | test_cmp expect actual' |
50aee995 SP |
84 | |
85 | cat >expect <<EOF | |
86 | 100644 blob file2 | |
87 | 100644 blob file3 | |
88 | 100755 blob file4 | |
89 | EOF | |
90 | test_expect_success \ | |
91 | 'A: verify tree' \ | |
5be60078 | 92 | 'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual && |
3af82863 | 93 | test_cmp expect actual' |
50aee995 | 94 | |
8232dc42 | 95 | echo "$file2_data" >expect |
50aee995 SP |
96 | test_expect_success \ |
97 | 'A: verify file2' \ | |
3af82863 | 98 | 'git cat-file blob master:file2 >actual && test_cmp expect actual' |
50aee995 | 99 | |
8232dc42 | 100 | echo "$file3_data" >expect |
50aee995 SP |
101 | test_expect_success \ |
102 | 'A: verify file3' \ | |
3af82863 | 103 | 'git cat-file blob master:file3 >actual && test_cmp expect actual' |
50aee995 | 104 | |
8232dc42 | 105 | printf "$file4_data" >expect |
50aee995 SP |
106 | test_expect_success \ |
107 | 'A: verify file4' \ | |
3af82863 | 108 | 'git cat-file blob master:file4 >actual && test_cmp expect actual' |
50aee995 | 109 | |
88fbf67b JH |
110 | cat >expect <<EOF |
111 | object $(git rev-parse refs/heads/master) | |
112 | type commit | |
113 | tag series-A | |
114 | ||
115 | An annotated tag without a tagger | |
116 | EOF | |
117 | test_expect_success 'A: verify tag/series-A' ' | |
118 | git cat-file tag tags/series-A >actual && | |
119 | test_cmp expect actual | |
120 | ' | |
121 | ||
50aee995 | 122 | cat >expect <<EOF |
5be60078 JH |
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` | |
50aee995 SP |
127 | EOF |
128 | test_expect_success \ | |
129 | 'A: verify marks output' \ | |
3af82863 | 130 | 'test_cmp expect marks.out' |
50aee995 | 131 | |
e8438420 SP |
132 | test_expect_success \ |
133 | 'A: verify marks import' \ | |
eaa2a6fc | 134 | 'git fast-import \ |
e8438420 SP |
135 | --import-marks=marks.out \ |
136 | --export-marks=marks.new \ | |
137 | </dev/null && | |
3af82863 | 138 | test_cmp expect marks.new' |
e8438420 | 139 | |
aac65ed1 SP |
140 | test_tick |
141 | cat >input <<INPUT_END | |
142 | commit refs/heads/verify--import-marks | |
143 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
144 | data <<COMMIT | |
145 | recreate from :5 | |
146 | COMMIT | |
147 | ||
148 | from :5 | |
149 | M 755 :2 copy-of-file2 | |
150 | ||
151 | INPUT_END | |
152 | test_expect_success \ | |
153 | 'A: verify marks import does not crash' \ | |
eaa2a6fc | 154 | 'git fast-import --import-marks=marks.out <input && |
5be60078 | 155 | git whatchanged verify--import-marks' |
aac65ed1 SP |
156 | test_expect_success \ |
157 | 'A: verify pack' \ | |
5be60078 | 158 | 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' |
aac65ed1 SP |
159 | cat >expect <<EOF |
160 | :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2 | |
161 | EOF | |
5be60078 | 162 | git diff-tree -M -r master verify--import-marks >actual |
aac65ed1 SP |
163 | test_expect_success \ |
164 | 'A: verify diff' \ | |
165 | 'compare_diff_raw expect actual && | |
5be60078 JH |
166 | test `git rev-parse --verify master:file2` \ |
167 | = `git rev-parse --verify verify--import-marks:copy-of-file2`' | |
aac65ed1 | 168 | |
7e7db5e4 RH |
169 | test_tick |
170 | mt=$(git hash-object --stdin < /dev/null) | |
171 | : >input.blob | |
172 | : >marks.exp | |
173 | : >tree.exp | |
174 | ||
175 | cat >input.commit <<EOF | |
176 | commit refs/heads/verify--dump-marks | |
177 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
178 | data <<COMMIT | |
179 | test the sparse array dumping routines with exponentially growing marks | |
180 | COMMIT | |
181 | EOF | |
182 | ||
183 | i=0 | |
184 | l=4 | |
185 | m=6 | |
186 | n=7 | |
187 | while test "$i" -lt 27; do | |
188 | cat >>input.blob <<EOF | |
189 | blob | |
190 | mark :$l | |
191 | data 0 | |
192 | blob | |
193 | mark :$m | |
194 | data 0 | |
195 | blob | |
196 | mark :$n | |
197 | data 0 | |
198 | EOF | |
199 | echo "M 100644 :$l l$i" >>input.commit | |
200 | echo "M 100644 :$m m$i" >>input.commit | |
201 | echo "M 100644 :$n n$i" >>input.commit | |
202 | ||
203 | echo ":$l $mt" >>marks.exp | |
204 | echo ":$m $mt" >>marks.exp | |
205 | echo ":$n $mt" >>marks.exp | |
206 | ||
207 | printf "100644 blob $mt\tl$i\n" >>tree.exp | |
208 | printf "100644 blob $mt\tm$i\n" >>tree.exp | |
209 | printf "100644 blob $mt\tn$i\n" >>tree.exp | |
210 | ||
211 | l=$(($l + $l)) | |
212 | m=$(($m + $m)) | |
213 | n=$(($l + $n)) | |
214 | ||
215 | i=$((1 + $i)) | |
216 | done | |
217 | ||
218 | sort tree.exp > tree.exp_s | |
219 | ||
220 | test_expect_success 'A: export marks with large values' ' | |
221 | cat input.blob input.commit | git fast-import --export-marks=marks.large && | |
222 | git ls-tree refs/heads/verify--dump-marks >tree.out && | |
223 | test_cmp tree.exp_s tree.out && | |
224 | test_cmp marks.exp marks.large' | |
225 | ||
50aee995 SP |
226 | ### |
227 | ### series B | |
228 | ### | |
229 | ||
230 | test_tick | |
231 | cat >input <<INPUT_END | |
232 | commit refs/heads/branch | |
233 | mark :1 | |
234 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
235 | data <<COMMIT | |
236 | corrupt | |
237 | COMMIT | |
238 | ||
239 | from refs/heads/master | |
240 | M 755 0000000000000000000000000000000000000001 zero1 | |
241 | ||
242 | INPUT_END | |
41ac414e | 243 | test_expect_success 'B: fail on invalid blob sha1' ' |
eaa2a6fc | 244 | test_must_fail git fast-import <input |
41ac414e | 245 | ' |
50aee995 SP |
246 | rm -f .git/objects/pack_* .git/objects/index_* |
247 | ||
ea08a6fd SP |
248 | cat >input <<INPUT_END |
249 | commit .badbranchname | |
250 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
251 | data <<COMMIT | |
252 | corrupt | |
253 | COMMIT | |
254 | ||
255 | from refs/heads/master | |
256 | ||
257 | INPUT_END | |
41ac414e | 258 | test_expect_success 'B: fail on invalid branch name ".badbranchname"' ' |
eaa2a6fc | 259 | test_must_fail git fast-import <input |
41ac414e | 260 | ' |
ea08a6fd SP |
261 | rm -f .git/objects/pack_* .git/objects/index_* |
262 | ||
263 | cat >input <<INPUT_END | |
264 | commit bad[branch]name | |
265 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
266 | data <<COMMIT | |
267 | corrupt | |
268 | COMMIT | |
269 | ||
270 | from refs/heads/master | |
271 | ||
272 | INPUT_END | |
41ac414e | 273 | test_expect_success 'B: fail on invalid branch name "bad[branch]name"' ' |
eaa2a6fc | 274 | test_must_fail git fast-import <input |
41ac414e | 275 | ' |
ea08a6fd SP |
276 | rm -f .git/objects/pack_* .git/objects/index_* |
277 | ||
278 | cat >input <<INPUT_END | |
279 | commit TEMP_TAG | |
280 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
281 | data <<COMMIT | |
282 | tag base | |
283 | COMMIT | |
284 | ||
285 | from refs/heads/master | |
286 | ||
287 | INPUT_END | |
288 | test_expect_success \ | |
289 | 'B: accept branch name "TEMP_TAG"' \ | |
eaa2a6fc | 290 | 'git fast-import <input && |
ea08a6fd SP |
291 | test -f .git/TEMP_TAG && |
292 | test `git rev-parse master` = `git rev-parse TEMP_TAG^`' | |
293 | rm -f .git/TEMP_TAG | |
294 | ||
50aee995 SP |
295 | ### |
296 | ### series C | |
297 | ### | |
298 | ||
eaa2a6fc | 299 | newf=`echo hi newf | git hash-object -w --stdin` |
5be60078 | 300 | oldf=`git rev-parse --verify master:file2` |
50aee995 SP |
301 | test_tick |
302 | cat >input <<INPUT_END | |
303 | commit refs/heads/branch | |
304 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
305 | data <<COMMIT | |
306 | second | |
307 | COMMIT | |
308 | ||
309 | from refs/heads/master | |
310 | M 644 $oldf file2/oldf | |
311 | M 755 $newf file2/newf | |
312 | D file3 | |
313 | ||
314 | INPUT_END | |
315 | test_expect_success \ | |
316 | 'C: incremental import create pack from stdin' \ | |
eaa2a6fc | 317 | 'git fast-import <input && |
5be60078 | 318 | git whatchanged branch' |
50aee995 SP |
319 | test_expect_success \ |
320 | 'C: verify pack' \ | |
5be60078 | 321 | 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' |
50aee995 SP |
322 | test_expect_success \ |
323 | 'C: validate reuse existing blob' \ | |
a48fcd83 | 324 | 'test $newf = `git rev-parse --verify branch:file2/newf` && |
5be60078 | 325 | test $oldf = `git rev-parse --verify branch:file2/oldf`' |
50aee995 SP |
326 | |
327 | cat >expect <<EOF | |
5be60078 | 328 | parent `git rev-parse --verify master^0` |
50aee995 SP |
329 | author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE |
330 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
331 | ||
332 | second | |
333 | EOF | |
334 | test_expect_success \ | |
335 | 'C: verify commit' \ | |
5be60078 | 336 | 'git cat-file commit branch | sed 1d >actual && |
3af82863 | 337 | test_cmp expect actual' |
50aee995 SP |
338 | |
339 | cat >expect <<EOF | |
340 | :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf | |
341 | :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf | |
342 | :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3 | |
343 | EOF | |
5be60078 | 344 | git diff-tree -M -r master branch >actual |
50aee995 SP |
345 | test_expect_success \ |
346 | 'C: validate rename result' \ | |
347 | 'compare_diff_raw expect actual' | |
348 | ||
b715cfbb SP |
349 | ### |
350 | ### series D | |
351 | ### | |
352 | ||
353 | test_tick | |
354 | cat >input <<INPUT_END | |
355 | commit refs/heads/branch | |
356 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
357 | data <<COMMIT | |
358 | third | |
359 | COMMIT | |
360 | ||
361 | from refs/heads/branch^0 | |
362 | M 644 inline newdir/interesting | |
363 | data <<EOF | |
364 | $file5_data | |
365 | EOF | |
366 | ||
367 | M 755 inline newdir/exec.sh | |
368 | data <<EOF | |
369 | $file6_data | |
370 | EOF | |
371 | ||
372 | INPUT_END | |
373 | test_expect_success \ | |
374 | 'D: inline data in commit' \ | |
eaa2a6fc | 375 | 'git fast-import <input && |
5be60078 | 376 | git whatchanged branch' |
b715cfbb SP |
377 | test_expect_success \ |
378 | 'D: verify pack' \ | |
5be60078 | 379 | 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' |
b715cfbb SP |
380 | |
381 | cat >expect <<EOF | |
382 | :000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A newdir/exec.sh | |
383 | :000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A newdir/interesting | |
384 | EOF | |
5be60078 | 385 | git diff-tree -M -r branch^ branch >actual |
b715cfbb SP |
386 | test_expect_success \ |
387 | 'D: validate new files added' \ | |
388 | 'compare_diff_raw expect actual' | |
389 | ||
390 | echo "$file5_data" >expect | |
391 | test_expect_success \ | |
392 | 'D: verify file5' \ | |
5be60078 | 393 | 'git cat-file blob branch:newdir/interesting >actual && |
3af82863 | 394 | test_cmp expect actual' |
b715cfbb SP |
395 | |
396 | echo "$file6_data" >expect | |
397 | test_expect_success \ | |
398 | 'D: verify file6' \ | |
5be60078 | 399 | 'git cat-file blob branch:newdir/exec.sh >actual && |
3af82863 | 400 | test_cmp expect actual' |
b715cfbb | 401 | |
63e0c8b3 SP |
402 | ### |
403 | ### series E | |
404 | ### | |
405 | ||
406 | cat >input <<INPUT_END | |
407 | commit refs/heads/branch | |
408 | author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500 | |
409 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500 | |
410 | data <<COMMIT | |
411 | RFC 2822 type date | |
412 | COMMIT | |
413 | ||
414 | from refs/heads/branch^0 | |
415 | ||
416 | INPUT_END | |
41ac414e | 417 | test_expect_success 'E: rfc2822 date, --date-format=raw' ' |
eaa2a6fc | 418 | test_must_fail git fast-import --date-format=raw <input |
41ac414e | 419 | ' |
63e0c8b3 SP |
420 | test_expect_success \ |
421 | 'E: rfc2822 date, --date-format=rfc2822' \ | |
eaa2a6fc | 422 | 'git fast-import --date-format=rfc2822 <input' |
63e0c8b3 SP |
423 | test_expect_success \ |
424 | 'E: verify pack' \ | |
5be60078 | 425 | 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' |
63e0c8b3 SP |
426 | |
427 | cat >expect <<EOF | |
428 | author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500 | |
429 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500 | |
430 | ||
431 | RFC 2822 type date | |
432 | EOF | |
433 | test_expect_success \ | |
434 | 'E: verify commit' \ | |
5be60078 | 435 | 'git cat-file commit branch | sed 1,2d >actual && |
3af82863 | 436 | test_cmp expect actual' |
63e0c8b3 | 437 | |
7073e69e SP |
438 | ### |
439 | ### series F | |
440 | ### | |
441 | ||
5be60078 | 442 | old_branch=`git rev-parse --verify branch^0` |
7073e69e SP |
443 | test_tick |
444 | cat >input <<INPUT_END | |
445 | commit refs/heads/branch | |
446 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
447 | data <<COMMIT | |
448 | losing things already? | |
449 | COMMIT | |
450 | ||
451 | from refs/heads/branch~1 | |
452 | ||
453 | reset refs/heads/other | |
454 | from refs/heads/branch | |
455 | ||
456 | INPUT_END | |
457 | test_expect_success \ | |
458 | 'F: non-fast-forward update skips' \ | |
eaa2a6fc | 459 | 'if git fast-import <input |
7073e69e SP |
460 | then |
461 | echo BAD gfi did not fail | |
462 | return 1 | |
463 | else | |
5be60078 | 464 | if test $old_branch = `git rev-parse --verify branch^0` |
7073e69e SP |
465 | then |
466 | : branch unaffected and failure returned | |
467 | return 0 | |
468 | else | |
469 | echo BAD gfi changed branch $old_branch | |
470 | return 1 | |
471 | fi | |
472 | fi | |
473 | ' | |
474 | test_expect_success \ | |
475 | 'F: verify pack' \ | |
5be60078 | 476 | 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' |
7073e69e SP |
477 | |
478 | cat >expect <<EOF | |
5be60078 JH |
479 | tree `git rev-parse branch~1^{tree}` |
480 | parent `git rev-parse branch~1` | |
7073e69e SP |
481 | author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE |
482 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
483 | ||
484 | losing things already? | |
485 | EOF | |
486 | test_expect_success \ | |
487 | 'F: verify other commit' \ | |
5be60078 | 488 | 'git cat-file commit other >actual && |
3af82863 | 489 | test_cmp expect actual' |
7073e69e SP |
490 | |
491 | ### | |
492 | ### series G | |
493 | ### | |
494 | ||
5be60078 | 495 | old_branch=`git rev-parse --verify branch^0` |
7073e69e SP |
496 | test_tick |
497 | cat >input <<INPUT_END | |
498 | commit refs/heads/branch | |
499 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
500 | data <<COMMIT | |
501 | losing things already? | |
502 | COMMIT | |
503 | ||
504 | from refs/heads/branch~1 | |
505 | ||
506 | INPUT_END | |
507 | test_expect_success \ | |
508 | 'G: non-fast-forward update forced' \ | |
eaa2a6fc | 509 | 'git fast-import --force <input' |
7073e69e SP |
510 | test_expect_success \ |
511 | 'G: verify pack' \ | |
5be60078 | 512 | 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' |
7073e69e SP |
513 | test_expect_success \ |
514 | 'G: branch changed, but logged' \ | |
5be60078 JH |
515 | 'test $old_branch != `git rev-parse --verify branch^0` && |
516 | test $old_branch = `git rev-parse --verify branch@{1}`' | |
7073e69e | 517 | |
825769a8 SP |
518 | ### |
519 | ### series H | |
520 | ### | |
521 | ||
522 | test_tick | |
523 | cat >input <<INPUT_END | |
524 | commit refs/heads/H | |
525 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
526 | data <<COMMIT | |
527 | third | |
528 | COMMIT | |
529 | ||
530 | from refs/heads/branch^0 | |
531 | M 644 inline i-will-die | |
532 | data <<EOF | |
533 | this file will never exist. | |
534 | EOF | |
535 | ||
536 | deleteall | |
537 | M 644 inline h/e/l/lo | |
538 | data <<EOF | |
539 | $file5_data | |
540 | EOF | |
541 | ||
542 | INPUT_END | |
543 | test_expect_success \ | |
544 | 'H: deletall, add 1' \ | |
eaa2a6fc | 545 | 'git fast-import <input && |
5be60078 | 546 | git whatchanged H' |
825769a8 SP |
547 | test_expect_success \ |
548 | 'H: verify pack' \ | |
5be60078 | 549 | 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' |
825769a8 SP |
550 | |
551 | cat >expect <<EOF | |
552 | :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf | |
553 | :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf | |
554 | :100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4 | |
555 | :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo | |
556 | :100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh | |
557 | EOF | |
5be60078 | 558 | git diff-tree -M -r H^ H >actual |
825769a8 SP |
559 | test_expect_success \ |
560 | 'H: validate old files removed, new files added' \ | |
561 | 'compare_diff_raw expect actual' | |
562 | ||
563 | echo "$file5_data" >expect | |
564 | test_expect_success \ | |
565 | 'H: verify file' \ | |
5be60078 | 566 | 'git cat-file blob H:h/e/l/lo >actual && |
3af82863 | 567 | test_cmp expect actual' |
825769a8 | 568 | |
bdf1c06d SP |
569 | ### |
570 | ### series I | |
571 | ### | |
572 | ||
573 | cat >input <<INPUT_END | |
574 | commit refs/heads/export-boundary | |
575 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
576 | data <<COMMIT | |
577 | we have a border. its only 40 characters wide. | |
578 | COMMIT | |
579 | ||
580 | from refs/heads/branch | |
581 | ||
582 | INPUT_END | |
583 | test_expect_success \ | |
584 | 'I: export-pack-edges' \ | |
eaa2a6fc | 585 | 'git fast-import --export-pack-edges=edges.list <input' |
bdf1c06d SP |
586 | |
587 | cat >expect <<EOF | |
5be60078 | 588 | .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary` |
bdf1c06d SP |
589 | EOF |
590 | test_expect_success \ | |
591 | 'I: verify edge list' \ | |
592 | 'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual && | |
3af82863 | 593 | test_cmp expect actual' |
bdf1c06d | 594 | |
ea5e370a SP |
595 | ### |
596 | ### series J | |
597 | ### | |
598 | ||
599 | cat >input <<INPUT_END | |
600 | commit refs/heads/J | |
601 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
602 | data <<COMMIT | |
603 | create J | |
604 | COMMIT | |
605 | ||
606 | from refs/heads/branch | |
607 | ||
608 | reset refs/heads/J | |
609 | ||
610 | commit refs/heads/J | |
611 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
612 | data <<COMMIT | |
613 | initialize J | |
614 | COMMIT | |
615 | ||
616 | INPUT_END | |
617 | test_expect_success \ | |
618 | 'J: reset existing branch creates empty commit' \ | |
eaa2a6fc | 619 | 'git fast-import <input' |
ea5e370a SP |
620 | test_expect_success \ |
621 | 'J: branch has 1 commit, empty tree' \ | |
5be60078 | 622 | 'test 1 = `git rev-list J | wc -l` && |
ea5e370a SP |
623 | test 0 = `git ls-tree J | wc -l`' |
624 | ||
625 | ### | |
626 | ### series K | |
627 | ### | |
628 | ||
629 | cat >input <<INPUT_END | |
630 | commit refs/heads/K | |
631 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
632 | data <<COMMIT | |
633 | create K | |
634 | COMMIT | |
635 | ||
636 | from refs/heads/branch | |
637 | ||
638 | commit refs/heads/K | |
639 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
640 | data <<COMMIT | |
641 | redo K | |
642 | COMMIT | |
643 | ||
644 | from refs/heads/branch^1 | |
645 | ||
646 | INPUT_END | |
647 | test_expect_success \ | |
648 | 'K: reinit branch with from' \ | |
eaa2a6fc | 649 | 'git fast-import <input' |
ea5e370a SP |
650 | test_expect_success \ |
651 | 'K: verify K^1 = branch^1' \ | |
5be60078 JH |
652 | 'test `git rev-parse --verify branch^1` \ |
653 | = `git rev-parse --verify K^1`' | |
ea5e370a | 654 | |
e7411303 JK |
655 | ### |
656 | ### series L | |
657 | ### | |
658 | ||
659 | cat >input <<INPUT_END | |
660 | blob | |
661 | mark :1 | |
662 | data <<EOF | |
663 | some data | |
664 | EOF | |
665 | ||
666 | blob | |
667 | mark :2 | |
668 | data <<EOF | |
669 | other data | |
670 | EOF | |
671 | ||
672 | commit refs/heads/L | |
673 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
674 | data <<COMMIT | |
675 | create L | |
676 | COMMIT | |
677 | ||
678 | M 644 :1 b. | |
679 | M 644 :1 b/other | |
680 | M 644 :1 ba | |
681 | ||
682 | commit refs/heads/L | |
683 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
684 | data <<COMMIT | |
685 | update L | |
686 | COMMIT | |
687 | ||
688 | M 644 :2 b. | |
689 | M 644 :2 b/other | |
690 | M 644 :2 ba | |
691 | INPUT_END | |
692 | ||
693 | cat >expect <<EXPECT_END | |
694 | :100644 100644 4268632... 55d3a52... M b. | |
695 | :040000 040000 0ae5cac... 443c768... M b | |
696 | :100644 100644 4268632... 55d3a52... M ba | |
697 | EXPECT_END | |
698 | ||
699 | test_expect_success \ | |
700 | 'L: verify internal tree sorting' \ | |
eaa2a6fc | 701 | 'git fast-import <input && |
82cb8afa | 702 | git diff-tree --abbrev --raw L^ L >output && |
3af82863 | 703 | test_cmp expect output' |
e7411303 | 704 | |
f39a946a SP |
705 | ### |
706 | ### series M | |
707 | ### | |
708 | ||
709 | test_tick | |
710 | cat >input <<INPUT_END | |
711 | commit refs/heads/M1 | |
712 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
713 | data <<COMMIT | |
714 | file rename | |
715 | COMMIT | |
716 | ||
717 | from refs/heads/branch^0 | |
718 | R file2/newf file2/n.e.w.f | |
719 | ||
720 | INPUT_END | |
721 | ||
722 | cat >expect <<EOF | |
723 | :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f | |
724 | EOF | |
725 | test_expect_success \ | |
726 | 'M: rename file in same subdirectory' \ | |
eaa2a6fc | 727 | 'git fast-import <input && |
f39a946a SP |
728 | git diff-tree -M -r M1^ M1 >actual && |
729 | compare_diff_raw expect actual' | |
730 | ||
731 | cat >input <<INPUT_END | |
732 | commit refs/heads/M2 | |
733 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
734 | data <<COMMIT | |
735 | file rename | |
736 | COMMIT | |
737 | ||
738 | from refs/heads/branch^0 | |
739 | R file2/newf i/am/new/to/you | |
740 | ||
741 | INPUT_END | |
742 | ||
743 | cat >expect <<EOF | |
744 | :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you | |
745 | EOF | |
746 | test_expect_success \ | |
747 | 'M: rename file to new subdirectory' \ | |
eaa2a6fc | 748 | 'git fast-import <input && |
f39a946a SP |
749 | git diff-tree -M -r M2^ M2 >actual && |
750 | compare_diff_raw expect actual' | |
751 | ||
752 | cat >input <<INPUT_END | |
753 | commit refs/heads/M3 | |
754 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
755 | data <<COMMIT | |
756 | file rename | |
757 | COMMIT | |
758 | ||
759 | from refs/heads/M2^0 | |
760 | R i other/sub | |
761 | ||
762 | INPUT_END | |
763 | ||
764 | cat >expect <<EOF | |
765 | :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you | |
766 | EOF | |
767 | test_expect_success \ | |
768 | 'M: rename subdirectory to new subdirectory' \ | |
eaa2a6fc | 769 | 'git fast-import <input && |
f39a946a SP |
770 | git diff-tree -M -r M3^ M3 >actual && |
771 | compare_diff_raw expect actual' | |
772 | ||
b6f3481b SP |
773 | ### |
774 | ### series N | |
775 | ### | |
776 | ||
777 | test_tick | |
778 | cat >input <<INPUT_END | |
779 | commit refs/heads/N1 | |
780 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
781 | data <<COMMIT | |
782 | file copy | |
783 | COMMIT | |
784 | ||
785 | from refs/heads/branch^0 | |
786 | C file2/newf file2/n.e.w.f | |
787 | ||
788 | INPUT_END | |
789 | ||
790 | cat >expect <<EOF | |
791 | :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f | |
792 | EOF | |
793 | test_expect_success \ | |
794 | 'N: copy file in same subdirectory' \ | |
eaa2a6fc | 795 | 'git fast-import <input && |
b6f3481b SP |
796 | git diff-tree -C --find-copies-harder -r N1^ N1 >actual && |
797 | compare_diff_raw expect actual' | |
798 | ||
799 | cat >input <<INPUT_END | |
800 | commit refs/heads/N2 | |
801 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
802 | data <<COMMIT | |
803 | clean directory copy | |
804 | COMMIT | |
805 | ||
806 | from refs/heads/branch^0 | |
807 | C file2 file3 | |
808 | ||
809 | commit refs/heads/N2 | |
810 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
811 | data <<COMMIT | |
812 | modify directory copy | |
813 | COMMIT | |
814 | ||
815 | M 644 inline file3/file5 | |
816 | data <<EOF | |
817 | $file5_data | |
818 | EOF | |
819 | ||
820 | INPUT_END | |
821 | ||
822 | cat >expect <<EOF | |
823 | :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5 | |
824 | :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf | |
825 | :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf | |
826 | EOF | |
827 | test_expect_success \ | |
828 | 'N: copy then modify subdirectory' \ | |
eaa2a6fc | 829 | 'git fast-import <input && |
b6f3481b SP |
830 | git diff-tree -C --find-copies-harder -r N2^^ N2 >actual && |
831 | compare_diff_raw expect actual' | |
832 | ||
833 | cat >input <<INPUT_END | |
834 | commit refs/heads/N3 | |
835 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
836 | data <<COMMIT | |
837 | dirty directory copy | |
838 | COMMIT | |
839 | ||
840 | from refs/heads/branch^0 | |
841 | M 644 inline file2/file5 | |
842 | data <<EOF | |
843 | $file5_data | |
844 | EOF | |
845 | ||
846 | C file2 file3 | |
847 | D file2/file5 | |
848 | ||
849 | INPUT_END | |
850 | ||
851 | test_expect_success \ | |
852 | 'N: copy dirty subdirectory' \ | |
eaa2a6fc NS |
853 | 'git fast-import <input && |
854 | test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`' | |
b6f3481b | 855 | |
334fba65 JN |
856 | test_expect_success \ |
857 | 'N: copy directory by id' \ | |
858 | 'cat >expect <<-\EOF && | |
859 | :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf | |
860 | :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf | |
861 | EOF | |
862 | subdir=$(git rev-parse refs/heads/branch^0:file2) && | |
863 | cat >input <<-INPUT_END && | |
864 | commit refs/heads/N4 | |
865 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
866 | data <<COMMIT | |
867 | copy by tree hash | |
868 | COMMIT | |
869 | ||
870 | from refs/heads/branch^0 | |
871 | M 040000 $subdir file3 | |
872 | INPUT_END | |
873 | git fast-import <input && | |
874 | git diff-tree -C --find-copies-harder -r N4^ N4 >actual && | |
875 | compare_diff_raw expect actual' | |
876 | ||
2794ad52 DB |
877 | test_expect_success \ |
878 | 'N: copy root directory by tree hash' \ | |
879 | 'cat >expect <<-\EOF && | |
880 | :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file3/newf | |
881 | :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file3/oldf | |
882 | EOF | |
883 | root=$(git rev-parse refs/heads/branch^0^{tree}) && | |
884 | cat >input <<-INPUT_END && | |
885 | commit refs/heads/N6 | |
886 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
887 | data <<COMMIT | |
888 | copy root directory by tree hash | |
889 | COMMIT | |
890 | ||
891 | from refs/heads/branch^0 | |
892 | M 040000 $root "" | |
893 | INPUT_END | |
894 | git fast-import <input && | |
895 | git diff-tree -C --find-copies-harder -r N4 N6 >actual && | |
896 | compare_diff_raw expect actual' | |
897 | ||
334fba65 JN |
898 | test_expect_success \ |
899 | 'N: modify copied tree' \ | |
900 | 'cat >expect <<-\EOF && | |
901 | :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5 | |
902 | :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf | |
903 | :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf | |
904 | EOF | |
905 | subdir=$(git rev-parse refs/heads/branch^0:file2) && | |
906 | cat >input <<-INPUT_END && | |
907 | commit refs/heads/N5 | |
908 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
909 | data <<COMMIT | |
910 | copy by tree hash | |
911 | COMMIT | |
912 | ||
913 | from refs/heads/branch^0 | |
914 | M 040000 $subdir file3 | |
915 | ||
916 | commit refs/heads/N5 | |
917 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
918 | data <<COMMIT | |
919 | modify directory copy | |
920 | COMMIT | |
921 | ||
922 | M 644 inline file3/file5 | |
923 | data <<EOF | |
924 | $file5_data | |
925 | EOF | |
926 | INPUT_END | |
927 | git fast-import <input && | |
928 | git diff-tree -C --find-copies-harder -r N5^^ N5 >actual && | |
929 | compare_diff_raw expect actual' | |
930 | ||
401d53fa SP |
931 | ### |
932 | ### series O | |
933 | ### | |
934 | ||
935 | cat >input <<INPUT_END | |
936 | #we will | |
937 | commit refs/heads/O1 | |
938 | # -- ignore all of this text | |
939 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
940 | # $GIT_COMMITTER_NAME has inserted here for his benefit. | |
941 | data <<COMMIT | |
942 | dirty directory copy | |
943 | COMMIT | |
944 | ||
945 | # don't forget the import blank line! | |
946 | # | |
947 | # yes, we started from our usual base of branch^0. | |
948 | # i like branch^0. | |
949 | from refs/heads/branch^0 | |
950 | # and we need to reuse file2/file5 from N3 above. | |
951 | M 644 inline file2/file5 | |
952 | # otherwise the tree will be different | |
953 | data <<EOF | |
954 | $file5_data | |
955 | EOF | |
956 | ||
957 | # don't forget to copy file2 to file3 | |
958 | C file2 file3 | |
959 | # | |
960 | # or to delete file5 from file2. | |
961 | D file2/file5 | |
962 | # are we done yet? | |
963 | ||
964 | INPUT_END | |
965 | ||
966 | test_expect_success \ | |
967 | 'O: comments are all skipped' \ | |
eaa2a6fc NS |
968 | 'git fast-import <input && |
969 | test `git rev-parse N3` = `git rev-parse O1`' | |
401d53fa | 970 | |
2c570cde SP |
971 | cat >input <<INPUT_END |
972 | commit refs/heads/O2 | |
973 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
974 | data <<COMMIT | |
975 | dirty directory copy | |
976 | COMMIT | |
977 | from refs/heads/branch^0 | |
978 | M 644 inline file2/file5 | |
979 | data <<EOF | |
980 | $file5_data | |
981 | EOF | |
982 | C file2 file3 | |
983 | D file2/file5 | |
984 | ||
985 | INPUT_END | |
986 | ||
987 | test_expect_success \ | |
988 | 'O: blank lines not necessary after data commands' \ | |
eaa2a6fc NS |
989 | 'git fast-import <input && |
990 | test `git rev-parse N3` = `git rev-parse O2`' | |
2c570cde | 991 | |
1fdb649c SP |
992 | test_expect_success \ |
993 | 'O: repack before next test' \ | |
994 | 'git repack -a -d' | |
995 | ||
996 | cat >input <<INPUT_END | |
997 | commit refs/heads/O3 | |
998 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
999 | data <<COMMIT | |
1000 | zstring | |
1001 | COMMIT | |
1002 | commit refs/heads/O3 | |
1003 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1004 | data <<COMMIT | |
1005 | zof | |
1006 | COMMIT | |
1007 | checkpoint | |
1008 | commit refs/heads/O3 | |
1009 | mark :5 | |
1010 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1011 | data <<COMMIT | |
1012 | zempty | |
1013 | COMMIT | |
1014 | checkpoint | |
1015 | commit refs/heads/O3 | |
1016 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1017 | data <<COMMIT | |
1018 | zcommits | |
1019 | COMMIT | |
1020 | reset refs/tags/O3-2nd | |
1021 | from :5 | |
655e8515 AS |
1022 | reset refs/tags/O3-3rd |
1023 | from :5 | |
1fdb649c SP |
1024 | INPUT_END |
1025 | ||
1026 | cat >expect <<INPUT_END | |
1027 | string | |
1028 | of | |
1029 | empty | |
1030 | commits | |
1031 | INPUT_END | |
1032 | test_expect_success \ | |
1033 | 'O: blank lines not necessary after other commands' \ | |
eaa2a6fc | 1034 | 'git fast-import <input && |
1fdb649c SP |
1035 | test 8 = `find .git/objects/pack -type f | wc -l` && |
1036 | test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` && | |
1037 | git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual && | |
3af82863 | 1038 | test_cmp expect actual' |
1fdb649c | 1039 | |
ac053c02 SP |
1040 | cat >input <<INPUT_END |
1041 | commit refs/heads/O4 | |
1042 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1043 | data <<COMMIT | |
1044 | zstring | |
1045 | COMMIT | |
1046 | commit refs/heads/O4 | |
1047 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1048 | data <<COMMIT | |
1049 | zof | |
1050 | COMMIT | |
1051 | progress Two commits down, 2 to go! | |
1052 | commit refs/heads/O4 | |
1053 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1054 | data <<COMMIT | |
1055 | zempty | |
1056 | COMMIT | |
1057 | progress Three commits down, 1 to go! | |
1058 | commit refs/heads/O4 | |
1059 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1060 | data <<COMMIT | |
1061 | zcommits | |
1062 | COMMIT | |
1063 | progress I'm done! | |
1064 | INPUT_END | |
1065 | test_expect_success \ | |
1066 | 'O: progress outputs as requested by input' \ | |
eaa2a6fc | 1067 | 'git fast-import <input >actual && |
ac053c02 | 1068 | grep "progress " <input >expect && |
3af82863 | 1069 | test_cmp expect actual' |
ac053c02 | 1070 | |
03db4525 AG |
1071 | ### |
1072 | ### series P (gitlinks) | |
1073 | ### | |
1074 | ||
1075 | cat >input <<INPUT_END | |
1076 | blob | |
1077 | mark :1 | |
1078 | data 10 | |
1079 | test file | |
1080 | ||
1081 | reset refs/heads/sub | |
1082 | commit refs/heads/sub | |
1083 | mark :2 | |
1084 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1085 | data 12 | |
1086 | sub_initial | |
1087 | M 100644 :1 file | |
1088 | ||
1089 | blob | |
1090 | mark :3 | |
1091 | data <<DATAEND | |
1092 | [submodule "sub"] | |
1093 | path = sub | |
1094 | url = "`pwd`/sub" | |
1095 | DATAEND | |
1096 | ||
1097 | commit refs/heads/subuse1 | |
1098 | mark :4 | |
1099 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1100 | data 8 | |
1101 | initial | |
1102 | from refs/heads/master | |
1103 | M 100644 :3 .gitmodules | |
1104 | M 160000 :2 sub | |
1105 | ||
1106 | blob | |
1107 | mark :5 | |
1108 | data 20 | |
1109 | test file | |
1110 | more data | |
1111 | ||
1112 | commit refs/heads/sub | |
1113 | mark :6 | |
1114 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1115 | data 11 | |
1116 | sub_second | |
1117 | from :2 | |
1118 | M 100644 :5 file | |
1119 | ||
1120 | commit refs/heads/subuse1 | |
1121 | mark :7 | |
1122 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1123 | data 7 | |
1124 | second | |
1125 | from :4 | |
1126 | M 160000 :6 sub | |
1127 | ||
1128 | INPUT_END | |
1129 | ||
1130 | test_expect_success \ | |
1131 | 'P: supermodule & submodule mix' \ | |
eaa2a6fc | 1132 | 'git fast-import <input && |
03db4525 | 1133 | git checkout subuse1 && |
fd4ec4f2 | 1134 | rm -rf sub && mkdir sub && (cd sub && |
03db4525 | 1135 | git init && |
8ee5d731 | 1136 | git fetch --update-head-ok .. refs/heads/sub:refs/heads/master && |
fd4ec4f2 | 1137 | git checkout master) && |
03db4525 AG |
1138 | git submodule init && |
1139 | git submodule update' | |
1140 | ||
eaa2a6fc NS |
1141 | SUBLAST=$(git rev-parse --verify sub) |
1142 | SUBPREV=$(git rev-parse --verify sub^) | |
03db4525 AG |
1143 | |
1144 | cat >input <<INPUT_END | |
1145 | blob | |
1146 | mark :1 | |
1147 | data <<DATAEND | |
1148 | [submodule "sub"] | |
1149 | path = sub | |
1150 | url = "`pwd`/sub" | |
1151 | DATAEND | |
1152 | ||
1153 | commit refs/heads/subuse2 | |
1154 | mark :2 | |
1155 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1156 | data 8 | |
1157 | initial | |
1158 | from refs/heads/master | |
1159 | M 100644 :1 .gitmodules | |
1160 | M 160000 $SUBPREV sub | |
1161 | ||
1162 | commit refs/heads/subuse2 | |
1163 | mark :3 | |
1164 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1165 | data 7 | |
1166 | second | |
1167 | from :2 | |
1168 | M 160000 $SUBLAST sub | |
1169 | ||
1170 | INPUT_END | |
1171 | ||
1172 | test_expect_success \ | |
1173 | 'P: verbatim SHA gitlinks' \ | |
1174 | 'git branch -D sub && | |
1175 | git gc && git prune && | |
eaa2a6fc NS |
1176 | git fast-import <input && |
1177 | test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)' | |
03db4525 AG |
1178 | |
1179 | test_tick | |
1180 | cat >input <<INPUT_END | |
1181 | commit refs/heads/subuse3 | |
1182 | mark :1 | |
1183 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1184 | data <<COMMIT | |
1185 | corrupt | |
1186 | COMMIT | |
1187 | ||
1188 | from refs/heads/subuse2 | |
1189 | M 160000 inline sub | |
1190 | data <<DATA | |
1191 | $SUBPREV | |
1192 | DATA | |
1193 | ||
1194 | INPUT_END | |
1195 | ||
1196 | test_expect_success 'P: fail on inline gitlink' ' | |
eaa2a6fc | 1197 | test_must_fail git fast-import <input' |
03db4525 AG |
1198 | |
1199 | test_tick | |
1200 | cat >input <<INPUT_END | |
1201 | blob | |
1202 | mark :1 | |
1203 | data <<DATA | |
1204 | $SUBPREV | |
1205 | DATA | |
1206 | ||
1207 | commit refs/heads/subuse3 | |
1208 | mark :2 | |
1209 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1210 | data <<COMMIT | |
1211 | corrupt | |
1212 | COMMIT | |
1213 | ||
1214 | from refs/heads/subuse2 | |
1215 | M 160000 :1 sub | |
1216 | ||
1217 | INPUT_END | |
1218 | ||
1219 | test_expect_success 'P: fail on blob mark in gitlink' ' | |
eaa2a6fc | 1220 | test_must_fail git fast-import <input' |
03db4525 | 1221 | |
a8dd2e7d JH |
1222 | ### |
1223 | ### series Q (notes) | |
1224 | ### | |
1225 | ||
2a113aee JH |
1226 | note1_data="The first note for the first commit" |
1227 | note2_data="The first note for the second commit" | |
1228 | note3_data="The first note for the third commit" | |
1229 | note1b_data="The second note for the first commit" | |
1230 | note1c_data="The third note for the first commit" | |
1231 | note2b_data="The second note for the second commit" | |
a8dd2e7d JH |
1232 | |
1233 | test_tick | |
1234 | cat >input <<INPUT_END | |
1235 | blob | |
1236 | mark :2 | |
1237 | data <<EOF | |
1238 | $file2_data | |
1239 | EOF | |
1240 | ||
1241 | commit refs/heads/notes-test | |
1242 | mark :3 | |
1243 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1244 | data <<COMMIT | |
1245 | first (:3) | |
1246 | COMMIT | |
1247 | ||
1248 | M 644 :2 file2 | |
1249 | ||
1250 | blob | |
1251 | mark :4 | |
1252 | data $file4_len | |
1253 | $file4_data | |
1254 | commit refs/heads/notes-test | |
1255 | mark :5 | |
1256 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1257 | data <<COMMIT | |
1258 | second (:5) | |
1259 | COMMIT | |
1260 | ||
1261 | M 644 :4 file4 | |
1262 | ||
1263 | commit refs/heads/notes-test | |
1264 | mark :6 | |
1265 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1266 | data <<COMMIT | |
1267 | third (:6) | |
1268 | COMMIT | |
1269 | ||
1270 | M 644 inline file5 | |
1271 | data <<EOF | |
1272 | $file5_data | |
1273 | EOF | |
1274 | ||
1275 | M 755 inline file6 | |
1276 | data <<EOF | |
1277 | $file6_data | |
1278 | EOF | |
1279 | ||
1280 | blob | |
1281 | mark :7 | |
1282 | data <<EOF | |
1283 | $note1_data | |
1284 | EOF | |
1285 | ||
1286 | blob | |
1287 | mark :8 | |
1288 | data <<EOF | |
1289 | $note2_data | |
1290 | EOF | |
1291 | ||
1292 | commit refs/notes/foobar | |
1293 | mark :9 | |
1294 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1295 | data <<COMMIT | |
1296 | notes (:9) | |
1297 | COMMIT | |
1298 | ||
1299 | N :7 :3 | |
1300 | N :8 :5 | |
1301 | N inline :6 | |
1302 | data <<EOF | |
1303 | $note3_data | |
1304 | EOF | |
1305 | ||
2a113aee JH |
1306 | commit refs/notes/foobar |
1307 | mark :10 | |
1308 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1309 | data <<COMMIT | |
1310 | notes (:10) | |
1311 | COMMIT | |
1312 | ||
1313 | N inline :3 | |
1314 | data <<EOF | |
1315 | $note1b_data | |
1316 | EOF | |
1317 | ||
1318 | commit refs/notes/foobar2 | |
1319 | mark :11 | |
1320 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1321 | data <<COMMIT | |
1322 | notes (:11) | |
1323 | COMMIT | |
1324 | ||
1325 | N inline :3 | |
1326 | data <<EOF | |
1327 | $note1c_data | |
1328 | EOF | |
1329 | ||
1330 | commit refs/notes/foobar | |
1331 | mark :12 | |
1332 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1333 | data <<COMMIT | |
1334 | notes (:12) | |
1335 | COMMIT | |
1336 | ||
1337 | deleteall | |
1338 | N inline :5 | |
1339 | data <<EOF | |
1340 | $note2b_data | |
1341 | EOF | |
1342 | ||
a8dd2e7d | 1343 | INPUT_END |
2a113aee | 1344 | |
a8dd2e7d JH |
1345 | test_expect_success \ |
1346 | 'Q: commit notes' \ | |
1347 | 'git fast-import <input && | |
1348 | git whatchanged notes-test' | |
1349 | test_expect_success \ | |
1350 | 'Q: verify pack' \ | |
1351 | 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' | |
1352 | ||
1353 | commit1=$(git rev-parse notes-test~2) | |
1354 | commit2=$(git rev-parse notes-test^) | |
1355 | commit3=$(git rev-parse notes-test) | |
1356 | ||
1357 | cat >expect <<EOF | |
1358 | author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1359 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1360 | ||
1361 | first (:3) | |
1362 | EOF | |
1363 | test_expect_success \ | |
1364 | 'Q: verify first commit' \ | |
1365 | 'git cat-file commit notes-test~2 | sed 1d >actual && | |
1366 | test_cmp expect actual' | |
1367 | ||
1368 | cat >expect <<EOF | |
1369 | parent $commit1 | |
1370 | author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1371 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1372 | ||
1373 | second (:5) | |
1374 | EOF | |
1375 | test_expect_success \ | |
1376 | 'Q: verify second commit' \ | |
1377 | 'git cat-file commit notes-test^ | sed 1d >actual && | |
1378 | test_cmp expect actual' | |
1379 | ||
1380 | cat >expect <<EOF | |
1381 | parent $commit2 | |
1382 | author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1383 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1384 | ||
1385 | third (:6) | |
1386 | EOF | |
1387 | test_expect_success \ | |
1388 | 'Q: verify third commit' \ | |
1389 | 'git cat-file commit notes-test | sed 1d >actual && | |
1390 | test_cmp expect actual' | |
1391 | ||
1392 | cat >expect <<EOF | |
1393 | author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1394 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1395 | ||
1396 | notes (:9) | |
1397 | EOF | |
1398 | test_expect_success \ | |
2a113aee JH |
1399 | 'Q: verify first notes commit' \ |
1400 | 'git cat-file commit refs/notes/foobar~2 | sed 1d >actual && | |
a8dd2e7d JH |
1401 | test_cmp expect actual' |
1402 | ||
1403 | cat >expect.unsorted <<EOF | |
1404 | 100644 blob $commit1 | |
1405 | 100644 blob $commit2 | |
1406 | 100644 blob $commit3 | |
1407 | EOF | |
1408 | cat expect.unsorted | sort >expect | |
1409 | test_expect_success \ | |
2a113aee JH |
1410 | 'Q: verify first notes tree' \ |
1411 | 'git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual && | |
a8dd2e7d JH |
1412 | test_cmp expect actual' |
1413 | ||
1414 | echo "$note1_data" >expect | |
1415 | test_expect_success \ | |
2a113aee JH |
1416 | 'Q: verify first note for first commit' \ |
1417 | 'git cat-file blob refs/notes/foobar~2:$commit1 >actual && test_cmp expect actual' | |
a8dd2e7d JH |
1418 | |
1419 | echo "$note2_data" >expect | |
1420 | test_expect_success \ | |
2a113aee JH |
1421 | 'Q: verify first note for second commit' \ |
1422 | 'git cat-file blob refs/notes/foobar~2:$commit2 >actual && test_cmp expect actual' | |
1423 | ||
1424 | echo "$note3_data" >expect | |
1425 | test_expect_success \ | |
1426 | 'Q: verify first note for third commit' \ | |
1427 | 'git cat-file blob refs/notes/foobar~2:$commit3 >actual && test_cmp expect actual' | |
1428 | ||
1429 | cat >expect <<EOF | |
1430 | parent `git rev-parse --verify refs/notes/foobar~2` | |
1431 | author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1432 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1433 | ||
1434 | notes (:10) | |
1435 | EOF | |
1436 | test_expect_success \ | |
1437 | 'Q: verify second notes commit' \ | |
1438 | 'git cat-file commit refs/notes/foobar^ | sed 1d >actual && | |
1439 | test_cmp expect actual' | |
1440 | ||
1441 | cat >expect.unsorted <<EOF | |
1442 | 100644 blob $commit1 | |
1443 | 100644 blob $commit2 | |
1444 | 100644 blob $commit3 | |
1445 | EOF | |
1446 | cat expect.unsorted | sort >expect | |
1447 | test_expect_success \ | |
1448 | 'Q: verify second notes tree' \ | |
1449 | 'git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual && | |
1450 | test_cmp expect actual' | |
1451 | ||
1452 | echo "$note1b_data" >expect | |
1453 | test_expect_success \ | |
1454 | 'Q: verify second note for first commit' \ | |
1455 | 'git cat-file blob refs/notes/foobar^:$commit1 >actual && test_cmp expect actual' | |
1456 | ||
1457 | echo "$note2_data" >expect | |
1458 | test_expect_success \ | |
1459 | 'Q: verify first note for second commit' \ | |
1460 | 'git cat-file blob refs/notes/foobar^:$commit2 >actual && test_cmp expect actual' | |
a8dd2e7d JH |
1461 | |
1462 | echo "$note3_data" >expect | |
1463 | test_expect_success \ | |
2a113aee JH |
1464 | 'Q: verify first note for third commit' \ |
1465 | 'git cat-file blob refs/notes/foobar^:$commit3 >actual && test_cmp expect actual' | |
1466 | ||
1467 | cat >expect <<EOF | |
1468 | author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1469 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1470 | ||
1471 | notes (:11) | |
1472 | EOF | |
1473 | test_expect_success \ | |
1474 | 'Q: verify third notes commit' \ | |
1475 | 'git cat-file commit refs/notes/foobar2 | sed 1d >actual && | |
1476 | test_cmp expect actual' | |
1477 | ||
1478 | cat >expect.unsorted <<EOF | |
1479 | 100644 blob $commit1 | |
1480 | EOF | |
1481 | cat expect.unsorted | sort >expect | |
1482 | test_expect_success \ | |
1483 | 'Q: verify third notes tree' \ | |
1484 | 'git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual && | |
1485 | test_cmp expect actual' | |
1486 | ||
1487 | echo "$note1c_data" >expect | |
1488 | test_expect_success \ | |
1489 | 'Q: verify third note for first commit' \ | |
1490 | 'git cat-file blob refs/notes/foobar2:$commit1 >actual && test_cmp expect actual' | |
1491 | ||
1492 | cat >expect <<EOF | |
1493 | parent `git rev-parse --verify refs/notes/foobar^` | |
1494 | author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1495 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1496 | ||
1497 | notes (:12) | |
1498 | EOF | |
1499 | test_expect_success \ | |
1500 | 'Q: verify fourth notes commit' \ | |
1501 | 'git cat-file commit refs/notes/foobar | sed 1d >actual && | |
1502 | test_cmp expect actual' | |
1503 | ||
1504 | cat >expect.unsorted <<EOF | |
1505 | 100644 blob $commit2 | |
1506 | EOF | |
1507 | cat expect.unsorted | sort >expect | |
1508 | test_expect_success \ | |
1509 | 'Q: verify fourth notes tree' \ | |
1510 | 'git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual && | |
1511 | test_cmp expect actual' | |
1512 | ||
1513 | echo "$note2b_data" >expect | |
1514 | test_expect_success \ | |
1515 | 'Q: verify second note for second commit' \ | |
1516 | 'git cat-file blob refs/notes/foobar:$commit2 >actual && test_cmp expect actual' | |
a8dd2e7d | 1517 | |
f963bd5d | 1518 | ### |
2792f26c | 1519 | ### series R (feature and option) |
f963bd5d SR |
1520 | ### |
1521 | ||
1522 | cat >input <<EOF | |
1523 | feature no-such-feature-exists | |
1524 | EOF | |
1525 | ||
1526 | test_expect_success 'R: abort on unsupported feature' ' | |
1527 | test_must_fail git fast-import <input | |
1528 | ' | |
1529 | ||
1530 | cat >input <<EOF | |
1531 | feature date-format=now | |
1532 | EOF | |
1533 | ||
1534 | test_expect_success 'R: supported feature is accepted' ' | |
1535 | git fast-import <input | |
1536 | ' | |
1537 | ||
1538 | cat >input << EOF | |
1539 | blob | |
1540 | data 3 | |
1541 | hi | |
1542 | feature date-format=now | |
1543 | EOF | |
1544 | ||
1545 | test_expect_success 'R: abort on receiving feature after data command' ' | |
1546 | test_must_fail git fast-import <input | |
1547 | ' | |
1548 | ||
081751c8 SR |
1549 | cat >input << EOF |
1550 | feature import-marks=git.marks | |
1551 | feature import-marks=git2.marks | |
1552 | EOF | |
1553 | ||
1554 | test_expect_success 'R: only one import-marks feature allowed per stream' ' | |
1555 | test_must_fail git fast-import <input | |
1556 | ' | |
1557 | ||
f963bd5d SR |
1558 | cat >input << EOF |
1559 | feature export-marks=git.marks | |
1560 | blob | |
1561 | mark :1 | |
1562 | data 3 | |
1563 | hi | |
1564 | ||
1565 | EOF | |
1566 | ||
1567 | test_expect_success \ | |
1568 | 'R: export-marks feature results in a marks file being created' \ | |
1569 | 'cat input | git fast-import && | |
1570 | grep :1 git.marks' | |
1571 | ||
1572 | test_expect_success \ | |
1573 | 'R: export-marks options can be overriden by commandline options' \ | |
1574 | 'cat input | git fast-import --export-marks=other.marks && | |
1575 | grep :1 other.marks' | |
1576 | ||
1577 | cat >input << EOF | |
1578 | feature import-marks=marks.out | |
1579 | feature export-marks=marks.new | |
1580 | EOF | |
1581 | ||
1582 | test_expect_success \ | |
1583 | 'R: import to output marks works without any content' \ | |
1584 | 'cat input | git fast-import && | |
1585 | test_cmp marks.out marks.new' | |
1586 | ||
1587 | cat >input <<EOF | |
1588 | feature import-marks=nonexistant.marks | |
1589 | feature export-marks=marks.new | |
1590 | EOF | |
1591 | ||
1592 | test_expect_success \ | |
1593 | 'R: import marks prefers commandline marks file over the stream' \ | |
1594 | 'cat input | git fast-import --import-marks=marks.out && | |
1595 | test_cmp marks.out marks.new' | |
1596 | ||
081751c8 SR |
1597 | |
1598 | cat >input <<EOF | |
1599 | feature import-marks=nonexistant.marks | |
1600 | feature export-marks=combined.marks | |
1601 | EOF | |
1602 | ||
1603 | test_expect_success 'R: multiple --import-marks= should be honoured' ' | |
1604 | head -n2 marks.out > one.marks && | |
1605 | tail -n +3 marks.out > two.marks && | |
1606 | git fast-import --import-marks=one.marks --import-marks=two.marks <input && | |
1607 | test_cmp marks.out combined.marks | |
1608 | ' | |
1609 | ||
bc3c79ae SR |
1610 | cat >input <<EOF |
1611 | feature relative-marks | |
1612 | feature import-marks=relative.in | |
1613 | feature export-marks=relative.out | |
1614 | EOF | |
1615 | ||
1616 | test_expect_success 'R: feature relative-marks should be honoured' ' | |
1617 | mkdir -p .git/info/fast-import/ && | |
1618 | cp marks.new .git/info/fast-import/relative.in && | |
1619 | git fast-import <input && | |
1620 | test_cmp marks.new .git/info/fast-import/relative.out | |
1621 | ' | |
1622 | ||
1623 | cat >input <<EOF | |
1624 | feature relative-marks | |
1625 | feature import-marks=relative.in | |
1626 | feature no-relative-marks | |
1627 | feature export-marks=non-relative.out | |
1628 | EOF | |
1629 | ||
1630 | test_expect_success 'R: feature no-relative-marks should be honoured' ' | |
1631 | git fast-import <input && | |
1632 | test_cmp marks.new non-relative.out | |
1633 | ' | |
1634 | ||
2792f26c SR |
1635 | cat >input << EOF |
1636 | option git quiet | |
1637 | blob | |
1638 | data 3 | |
1639 | hi | |
1640 | ||
1641 | EOF | |
1642 | ||
1643 | touch empty | |
1644 | ||
1645 | test_expect_success 'R: quiet option results in no stats being output' ' | |
1646 | cat input | git fast-import 2> output && | |
1647 | test_cmp empty output | |
1648 | ' | |
1649 | ||
1650 | cat >input <<EOF | |
1651 | option git non-existing-option | |
1652 | EOF | |
1653 | ||
1654 | test_expect_success 'R: die on unknown option' ' | |
1655 | test_must_fail git fast-import <input | |
1656 | ' | |
1657 | ||
1658 | test_expect_success 'R: unknown commandline options are rejected' '\ | |
1659 | test_must_fail git fast-import --non-existing-option < /dev/null | |
1660 | ' | |
1661 | ||
a9ff277e JN |
1662 | test_expect_success 'R: die on invalid option argument' ' |
1663 | echo "option git active-branches=-5" | | |
1664 | test_must_fail git fast-import && | |
1665 | echo "option git depth=" | | |
1666 | test_must_fail git fast-import && | |
1667 | test_must_fail git fast-import --depth="5 elephants" </dev/null | |
1668 | ' | |
1669 | ||
2792f26c SR |
1670 | cat >input <<EOF |
1671 | option non-existing-vcs non-existing-option | |
1672 | EOF | |
1673 | ||
1674 | test_expect_success 'R: ignore non-git options' ' | |
1675 | git fast-import <input | |
1676 | ' | |
1677 | ||
5eef828b SP |
1678 | ## |
1679 | ## R: very large blobs | |
1680 | ## | |
1681 | blobsize=$((2*1024*1024 + 53)) | |
1682 | test-genrandom bar $blobsize >expect | |
1683 | cat >input <<INPUT_END | |
1684 | commit refs/heads/big-file | |
1685 | committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE | |
1686 | data <<COMMIT | |
1687 | R - big file | |
1688 | COMMIT | |
1689 | ||
1690 | M 644 inline big1 | |
1691 | data $blobsize | |
1692 | INPUT_END | |
1693 | cat expect >>input | |
1694 | cat >>input <<INPUT_END | |
1695 | M 644 inline big2 | |
1696 | data $blobsize | |
1697 | INPUT_END | |
1698 | cat expect >>input | |
1699 | echo >>input | |
1700 | ||
1701 | test_expect_success \ | |
1702 | 'R: blob bigger than threshold' \ | |
1703 | 'test_create_repo R && | |
1704 | git --git-dir=R/.git fast-import --big-file-threshold=1 <input' | |
1705 | test_expect_success \ | |
1706 | 'R: verify created pack' \ | |
1707 | ': >verify && | |
1708 | for p in R/.git/objects/pack/*.pack; | |
1709 | do | |
1710 | git verify-pack -v $p >>verify || exit; | |
1711 | done' | |
1712 | test_expect_success \ | |
1713 | 'R: verify written objects' \ | |
1714 | 'git --git-dir=R/.git cat-file blob big-file:big1 >actual && | |
1715 | test_cmp expect actual && | |
1716 | a=$(git --git-dir=R/.git rev-parse big-file:big1) && | |
1717 | b=$(git --git-dir=R/.git rev-parse big-file:big2) && | |
1718 | test $a = $b' | |
1719 | test_expect_success \ | |
1720 | 'R: blob appears only once' \ | |
1721 | 'n=$(grep $a verify | wc -l) && | |
1722 | test 1 = $n' | |
1723 | ||
50aee995 | 1724 | test_done |