]>
Commit | Line | Data |
---|---|---|
f2dc849e JS |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2007 Johannes E. Schindelin | |
4 | # | |
5 | ||
eaa2a6fc | 6 | test_description='git fast-export' |
f2dc849e JS |
7 | . ./test-lib.sh |
8 | ||
9 | test_expect_success 'setup' ' | |
10 | ||
ebeec7db EN |
11 | echo break it > file0 && |
12 | git add file0 && | |
13 | test_tick && | |
f2dc849e JS |
14 | echo Wohlauf > file && |
15 | git add file && | |
16 | test_tick && | |
17 | git commit -m initial && | |
18 | echo die Luft > file && | |
19 | echo geht frisch > file2 && | |
20 | git add file file2 && | |
21 | test_tick && | |
22 | git commit -m second && | |
23 | echo und > file2 && | |
24 | test_tick && | |
25 | git commit -m third file2 && | |
26 | test_tick && | |
27 | git tag rein && | |
28 | git checkout -b wer HEAD^ && | |
a48fcd83 | 29 | echo lange > file2 && |
f2dc849e JS |
30 | test_tick && |
31 | git commit -m sitzt file2 && | |
32 | test_tick && | |
33 | git tag -a -m valentin muss && | |
34 | git merge -s ours master | |
35 | ||
36 | ' | |
37 | ||
38 | test_expect_success 'fast-export | fast-import' ' | |
39 | ||
40 | MASTER=$(git rev-parse --verify master) && | |
41 | REIN=$(git rev-parse --verify rein) && | |
42 | WER=$(git rev-parse --verify wer) && | |
43 | MUSS=$(git rev-parse --verify muss) && | |
44 | mkdir new && | |
45 | git --git-dir=new/.git init && | |
a4d4e32a | 46 | git fast-export --all >actual && |
f2dc849e JS |
47 | (cd new && |
48 | git fast-import && | |
49 | test $MASTER = $(git rev-parse --verify refs/heads/master) && | |
50 | test $REIN = $(git rev-parse --verify refs/tags/rein) && | |
51 | test $WER = $(git rev-parse --verify refs/heads/wer) && | |
a4d4e32a | 52 | test $MUSS = $(git rev-parse --verify refs/tags/muss)) <actual |
f2dc849e JS |
53 | |
54 | ' | |
55 | ||
56 | test_expect_success 'fast-export master~2..master' ' | |
57 | ||
a4d4e32a PK |
58 | git fast-export master~2..master >actual && |
59 | sed "s/master/partial/" actual | | |
f2dc849e JS |
60 | (cd new && |
61 | git fast-import && | |
62 | test $MASTER != $(git rev-parse --verify refs/heads/partial) && | |
ebeec7db EN |
63 | git diff --exit-code master partial && |
64 | git diff --exit-code master^ partial^ && | |
d492b31c | 65 | test_must_fail git rev-parse partial~2) |
f2dc849e JS |
66 | |
67 | ' | |
68 | ||
530ca19c EN |
69 | test_expect_success 'fast-export --reference-excluded-parents master~2..master' ' |
70 | ||
71 | git fast-export --reference-excluded-parents master~2..master >actual && | |
72 | grep commit.refs/heads/master actual >commit-count && | |
73 | test_line_count = 2 commit-count && | |
74 | sed "s/master/rewrite/" actual | | |
75 | (cd new && | |
76 | git fast-import && | |
77 | test $MASTER = $(git rev-parse --verify refs/heads/rewrite)) | |
78 | ' | |
79 | ||
f2dc849e JS |
80 | test_expect_success 'iso-8859-1' ' |
81 | ||
e0d44c50 | 82 | git config i18n.commitencoding ISO8859-1 && |
f2dc849e | 83 | # use author and committer name in ISO-8859-1 to match it. |
8a7f8bed | 84 | . "$TEST_DIRECTORY"/t3901/8859-1.txt && |
f2dc849e JS |
85 | test_tick && |
86 | echo rosten >file && | |
87 | git commit -s -m den file && | |
a4d4e32a PK |
88 | git fast-export wer^..wer >iso8859-1.fi && |
89 | sed "s/wer/i18n/" iso8859-1.fi | | |
f2dc849e JS |
90 | (cd new && |
91 | git fast-import && | |
a4d4e32a PK |
92 | git cat-file commit i18n >actual && |
93 | grep "Áéí óú" actual) | |
f2dc849e | 94 | |
df6a7ff7 PB |
95 | ' |
96 | test_expect_success 'import/export-marks' ' | |
97 | ||
98 | git checkout -b marks master && | |
99 | git fast-export --export-marks=tmp-marks HEAD && | |
100 | test -s tmp-marks && | |
3fb0459b | 101 | test_line_count = 3 tmp-marks && |
a4d4e32a PK |
102 | git fast-export --import-marks=tmp-marks \ |
103 | --export-marks=tmp-marks HEAD >actual && | |
104 | test $(grep ^commit actual | wc -l) -eq 0 && | |
df6a7ff7 PB |
105 | echo change > file && |
106 | git commit -m "last commit" file && | |
a4d4e32a PK |
107 | git fast-export --import-marks=tmp-marks \ |
108 | --export-marks=tmp-marks HEAD >actual && | |
109 | test $(grep ^commit\ actual | wc -l) -eq 1 && | |
3fb0459b | 110 | test_line_count = 4 tmp-marks |
df6a7ff7 | 111 | |
f2dc849e JS |
112 | ' |
113 | ||
114 | cat > signed-tag-import << EOF | |
115 | tag sign-your-name | |
116 | from $(git rev-parse HEAD) | |
117 | tagger C O Mitter <committer@example.com> 1112911993 -0700 | |
118 | data 210 | |
119 | A message for a sign | |
120 | -----BEGIN PGP SIGNATURE----- | |
121 | Version: GnuPG v1.4.5 (GNU/Linux) | |
122 | ||
123 | fakedsignaturefakedsignaturefakedsignaturefakedsignaturfakedsign | |
124 | aturefakedsignaturefake= | |
125 | =/59v | |
126 | -----END PGP SIGNATURE----- | |
127 | EOF | |
128 | ||
129 | test_expect_success 'set up faked signed tag' ' | |
130 | ||
131 | cat signed-tag-import | git fast-import | |
132 | ||
133 | ' | |
134 | ||
135 | test_expect_success 'signed-tags=abort' ' | |
136 | ||
d492b31c | 137 | test_must_fail git fast-export --signed-tags=abort sign-your-name |
f2dc849e JS |
138 | |
139 | ' | |
140 | ||
ee4bc371 | 141 | test_expect_success 'signed-tags=verbatim' ' |
f2dc849e | 142 | |
ee4bc371 | 143 | git fast-export --signed-tags=verbatim sign-your-name > output && |
f2dc849e JS |
144 | grep PGP output |
145 | ||
146 | ' | |
147 | ||
148 | test_expect_success 'signed-tags=strip' ' | |
149 | ||
150 | git fast-export --signed-tags=strip sign-your-name > output && | |
151 | ! grep PGP output | |
152 | ||
153 | ' | |
154 | ||
cd16c59b JK |
155 | test_expect_success 'signed-tags=warn-strip' ' |
156 | git fast-export --signed-tags=warn-strip sign-your-name >output 2>err && | |
157 | ! grep PGP output && | |
158 | test -s err | |
159 | ' | |
160 | ||
03db4525 AG |
161 | test_expect_success 'setup submodule' ' |
162 | ||
163 | git checkout -f master && | |
164 | mkdir sub && | |
4c367c6a JH |
165 | ( |
166 | cd sub && | |
167 | git init && | |
168 | echo test file > file && | |
169 | git add file && | |
170 | git commit -m sub_initial | |
171 | ) && | |
c7b793a1 | 172 | git submodule add "$(pwd)/sub" sub && |
03db4525 AG |
173 | git commit -m initial && |
174 | test_tick && | |
4c367c6a JH |
175 | ( |
176 | cd sub && | |
177 | echo more data >> file && | |
178 | git add file && | |
179 | git commit -m sub_second | |
180 | ) && | |
03db4525 AG |
181 | git add sub && |
182 | git commit -m second | |
183 | ||
184 | ' | |
185 | ||
186 | test_expect_success 'submodule fast-export | fast-import' ' | |
187 | ||
188 | SUBENT1=$(git ls-tree master^ sub) && | |
189 | SUBENT2=$(git ls-tree master sub) && | |
190 | rm -rf new && | |
191 | mkdir new && | |
192 | git --git-dir=new/.git init && | |
a4d4e32a | 193 | git fast-export --signed-tags=strip --all >actual && |
03db4525 AG |
194 | (cd new && |
195 | git fast-import && | |
196 | test "$SUBENT1" = "$(git ls-tree refs/heads/master^ sub)" && | |
197 | test "$SUBENT2" = "$(git ls-tree refs/heads/master sub)" && | |
198 | git checkout master && | |
199 | git submodule init && | |
200 | git submodule update && | |
a4d4e32a | 201 | cmp sub/file ../sub/file) <actual |
03db4525 AG |
202 | |
203 | ' | |
204 | ||
91e80b98 JH |
205 | GIT_AUTHOR_NAME='A U Thor'; export GIT_AUTHOR_NAME |
206 | GIT_COMMITTER_NAME='C O Mitter'; export GIT_COMMITTER_NAME | |
ae7c5dce AG |
207 | |
208 | test_expect_success 'setup copies' ' | |
209 | ||
210 | git config --unset i18n.commitencoding && | |
211 | git checkout -b copy rein && | |
212 | git mv file file3 && | |
213 | git commit -m move1 && | |
214 | test_tick && | |
215 | cp file2 file4 && | |
216 | git add file4 && | |
217 | git mv file2 file5 && | |
218 | git commit -m copy1 && | |
219 | test_tick && | |
220 | cp file3 file6 && | |
221 | git add file6 && | |
222 | git commit -m copy2 && | |
223 | test_tick && | |
224 | echo more text >> file6 && | |
225 | echo even more text >> file6 && | |
226 | git add file6 && | |
227 | git commit -m modify && | |
228 | test_tick && | |
229 | cp file6 file7 && | |
230 | echo test >> file7 && | |
231 | git add file7 && | |
232 | git commit -m copy_modify | |
233 | ||
234 | ' | |
235 | ||
236 | test_expect_success 'fast-export -C -C | fast-import' ' | |
237 | ||
238 | ENTRY=$(git rev-parse --verify copy) && | |
239 | rm -rf new && | |
240 | mkdir new && | |
241 | git --git-dir=new/.git init && | |
242 | git fast-export -C -C --signed-tags=strip --all > output && | |
b3e8ca89 | 243 | grep "^C file2 file4\$" output && |
ae7c5dce AG |
244 | cat output | |
245 | (cd new && | |
246 | git fast-import && | |
247 | test $ENTRY = $(git rev-parse --verify refs/heads/copy)) | |
248 | ||
249 | ' | |
250 | ||
2075ffb5 | 251 | test_expect_success 'fast-export | fast-import when master is tagged' ' |
283b9532 MV |
252 | |
253 | git tag -m msg last && | |
254 | git fast-export -C -C --signed-tags=strip --all > output && | |
255 | test $(grep -c "^tag " output) = 3 | |
256 | ||
257 | ' | |
258 | ||
4e46a8d6 JS |
259 | cat > tag-content << EOF |
260 | object $(git rev-parse HEAD) | |
261 | type commit | |
262 | tag rosten | |
263 | EOF | |
264 | ||
265 | test_expect_success 'cope with tagger-less tags' ' | |
266 | ||
267 | TAG=$(git hash-object -t tag -w tag-content) && | |
268 | git update-ref refs/tags/sonnenschein $TAG && | |
269 | git fast-export -C -C --signed-tags=strip --all > output && | |
270 | test $(grep -c "^tag " output) = 4 && | |
271 | ! grep "Unspecified Tagger" output && | |
272 | git fast-export -C -C --signed-tags=strip --all \ | |
273 | --fake-missing-tagger > output && | |
274 | test $(grep -c "^tag " output) = 4 && | |
275 | grep "Unspecified Tagger" output | |
276 | ||
277 | ' | |
278 | ||
25e0ca5d EN |
279 | test_expect_success 'setup for limiting exports by PATH' ' |
280 | mkdir limit-by-paths && | |
4c367c6a JH |
281 | ( |
282 | cd limit-by-paths && | |
283 | git init && | |
284 | echo hi > there && | |
285 | git add there && | |
286 | git commit -m "First file" && | |
287 | echo foo > bar && | |
288 | git add bar && | |
289 | git commit -m "Second file" && | |
290 | git tag -a -m msg mytag && | |
291 | echo morefoo >> bar && | |
292 | git add bar && | |
293 | git commit -m "Change to second file" | |
294 | ) | |
25e0ca5d EN |
295 | ' |
296 | ||
297 | cat > limit-by-paths/expected << EOF | |
298 | blob | |
299 | mark :1 | |
300 | data 3 | |
301 | hi | |
302 | ||
303 | reset refs/tags/mytag | |
304 | commit refs/tags/mytag | |
305 | mark :2 | |
306 | author A U Thor <author@example.com> 1112912713 -0700 | |
307 | committer C O Mitter <committer@example.com> 1112912713 -0700 | |
308 | data 11 | |
309 | First file | |
310 | M 100644 :1 there | |
311 | ||
312 | EOF | |
313 | ||
314 | test_expect_success 'dropping tag of filtered out object' ' | |
4c367c6a | 315 | ( |
25e0ca5d EN |
316 | cd limit-by-paths && |
317 | git fast-export --tag-of-filtered-object=drop mytag -- there > output && | |
9ff10fc8 | 318 | test_cmp expected output |
4c367c6a | 319 | ) |
25e0ca5d EN |
320 | ' |
321 | ||
322 | cat >> limit-by-paths/expected << EOF | |
323 | tag mytag | |
324 | from :2 | |
325 | tagger C O Mitter <committer@example.com> 1112912713 -0700 | |
326 | data 4 | |
327 | msg | |
328 | ||
329 | EOF | |
330 | ||
331 | test_expect_success 'rewriting tag of filtered out object' ' | |
4c367c6a | 332 | ( |
25e0ca5d EN |
333 | cd limit-by-paths && |
334 | git fast-export --tag-of-filtered-object=rewrite mytag -- there > output && | |
9ff10fc8 | 335 | test_cmp expected output |
4c367c6a | 336 | ) |
25e0ca5d EN |
337 | ' |
338 | ||
1f30c904 EN |
339 | test_expect_success 'rewrite tag predating pathspecs to nothing' ' |
340 | test_create_repo rewrite_tag_predating_pathspecs && | |
341 | ( | |
342 | cd rewrite_tag_predating_pathspecs && | |
343 | ||
344 | test_commit initial && | |
345 | ||
346 | git tag -a -m "Some old tag" v0.0.0.0.0.0.1 && | |
347 | ||
348 | test_commit bar && | |
349 | ||
350 | git fast-export --tag-of-filtered-object=rewrite --all -- bar.t >output && | |
351 | grep from.$ZERO_OID output | |
352 | ) | |
353 | ' | |
354 | ||
25e0ca5d EN |
355 | cat > limit-by-paths/expected << EOF |
356 | blob | |
357 | mark :1 | |
358 | data 4 | |
359 | foo | |
360 | ||
361 | blob | |
362 | mark :2 | |
363 | data 3 | |
364 | hi | |
365 | ||
366 | reset refs/heads/master | |
367 | commit refs/heads/master | |
368 | mark :3 | |
369 | author A U Thor <author@example.com> 1112912713 -0700 | |
370 | committer C O Mitter <committer@example.com> 1112912713 -0700 | |
371 | data 12 | |
372 | Second file | |
373 | M 100644 :1 bar | |
374 | M 100644 :2 there | |
375 | ||
376 | EOF | |
377 | ||
378 | test_expect_failure 'no exact-ref revisions included' ' | |
4c367c6a JH |
379 | ( |
380 | cd limit-by-paths && | |
381 | git fast-export master~2..master~1 > output && | |
9ff10fc8 | 382 | test_cmp expected output |
4c367c6a | 383 | ) |
25e0ca5d EN |
384 | ' |
385 | ||
4087a02e EN |
386 | test_expect_success 'path limiting with import-marks does not lose unmodified files' ' |
387 | git checkout -b simple marks~2 && | |
388 | git fast-export --export-marks=marks simple -- file > /dev/null && | |
389 | echo more content >> file && | |
390 | test_tick && | |
391 | git commit -mnext file && | |
a4d4e32a PK |
392 | git fast-export --import-marks=marks simple -- file file0 >actual && |
393 | grep file0 actual | |
4087a02e EN |
394 | ' |
395 | ||
cd13762d EN |
396 | test_expect_success 'avoid corrupt stream with non-existent mark' ' |
397 | test_create_repo avoid_non_existent_mark && | |
398 | ( | |
399 | cd avoid_non_existent_mark && | |
400 | ||
401 | test_commit important-path && | |
402 | ||
403 | test_commit ignored && | |
404 | ||
405 | git branch A && | |
406 | git branch B && | |
407 | ||
408 | echo foo >>important-path.t && | |
409 | git add important-path.t && | |
410 | test_commit more changes && | |
411 | ||
412 | git fast-export --all -- important-path.t | git fast-import --force | |
413 | ) | |
414 | ' | |
415 | ||
7f40ab09 EN |
416 | test_expect_success 'full-tree re-shows unmodified files' ' |
417 | git checkout -f simple && | |
a4d4e32a PK |
418 | git fast-export --full-tree simple >actual && |
419 | test $(grep -c file0 actual) -eq 3 | |
7f40ab09 EN |
420 | ' |
421 | ||
41a5c70f EFL |
422 | test_expect_success 'set-up a few more tags for tag export tests' ' |
423 | git checkout -f master && | |
c7b793a1 | 424 | HEAD_TREE=$(git show -s --pretty=raw HEAD | grep tree | sed "s/tree //") && |
41a5c70f EFL |
425 | git tag tree_tag -m "tagging a tree" $HEAD_TREE && |
426 | git tag -a tree_tag-obj -m "tagging a tree" $HEAD_TREE && | |
427 | git tag tag-obj_tag -m "tagging a tag" tree_tag-obj && | |
428 | git tag -a tag-obj_tag-obj -m "tagging a tag" tree_tag-obj | |
429 | ' | |
430 | ||
02c48cd6 EN |
431 | test_expect_success 'tree_tag' ' |
432 | mkdir result && | |
433 | (cd result && git init) && | |
434 | git fast-export tree_tag > fe-stream && | |
435 | (cd result && git fast-import < ../fe-stream) | |
436 | ' | |
437 | ||
41a5c70f | 438 | # NEEDSWORK: not just check return status, but validate the output |
c0582c53 | 439 | test_expect_success 'tree_tag-obj' 'git fast-export tree_tag-obj' |
1982467d EFL |
440 | test_expect_success 'tag-obj_tag' 'git fast-export tag-obj_tag' |
441 | test_expect_success 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj' | |
41a5c70f | 442 | |
889c6f0e | 443 | test_expect_success 'directory becomes symlink' ' |
f15652d9 EN |
444 | git init dirtosymlink && |
445 | git init result && | |
446 | ( | |
447 | cd dirtosymlink && | |
448 | mkdir foo && | |
449 | mkdir bar && | |
450 | echo hello > foo/world && | |
451 | echo hello > bar/world && | |
452 | git add foo/world bar/world && | |
453 | git commit -q -mone && | |
454 | git rm -r foo && | |
889c6f0e | 455 | test_ln_s_add bar foo && |
f15652d9 EN |
456 | git commit -q -mtwo |
457 | ) && | |
458 | ( | |
459 | cd dirtosymlink && | |
460 | git fast-export master -- foo | | |
461 | (cd ../result && git fast-import --quiet) | |
462 | ) && | |
463 | (cd result && git show master:foo) | |
464 | ' | |
465 | ||
6280dfdc JK |
466 | test_expect_success 'fast-export quotes pathnames' ' |
467 | git init crazy-paths && | |
468 | (cd crazy-paths && | |
c7b793a1 | 469 | blob=$(echo foo | git hash-object -w --stdin) && |
6280dfdc JK |
470 | git update-index --add \ |
471 | --cacheinfo 100644 $blob "$(printf "path with\\nnewline")" \ | |
472 | --cacheinfo 100644 $blob "path with \"quote\"" \ | |
473 | --cacheinfo 100644 $blob "path with \\backslash" \ | |
474 | --cacheinfo 100644 $blob "path with space" && | |
475 | git commit -m addition && | |
94221d22 | 476 | git ls-files -z -s | perl -0pe "s{\\t}{$&subdir/}" >index && |
6280dfdc JK |
477 | git read-tree --empty && |
478 | git update-index -z --index-info <index && | |
479 | git commit -m rename && | |
480 | git read-tree --empty && | |
481 | git commit -m deletion && | |
ff59f6da | 482 | git fast-export -M HEAD >export.out && |
6280dfdc JK |
483 | git rev-list HEAD >expect && |
484 | git init result && | |
485 | cd result && | |
486 | git fast-import <../export.out && | |
487 | git rev-list HEAD >actual && | |
488 | test_cmp ../expect actual | |
489 | ) | |
490 | ' | |
491 | ||
5d3698ff FC |
492 | test_expect_success 'test bidirectionality' ' |
493 | >marks-cur && | |
494 | >marks-new && | |
495 | git init marks-test && | |
496 | git fast-export --export-marks=marks-cur --import-marks=marks-cur --branches | \ | |
497 | git --git-dir=marks-test/.git fast-import --export-marks=marks-new --import-marks=marks-new && | |
498 | (cd marks-test && | |
499 | git reset --hard && | |
500 | echo Wohlauf > file && | |
501 | git commit -a -m "back in time") && | |
502 | git --git-dir=marks-test/.git fast-export --export-marks=marks-new --import-marks=marks-new --branches | \ | |
503 | git fast-import --export-marks=marks-cur --import-marks=marks-cur | |
504 | ' | |
505 | ||
49266e8a FC |
506 | cat > expected << EOF |
507 | blob | |
508 | mark :13 | |
509 | data 5 | |
510 | bump | |
511 | ||
512 | commit refs/heads/master | |
513 | mark :14 | |
514 | author A U Thor <author@example.com> 1112912773 -0700 | |
515 | committer C O Mitter <committer@example.com> 1112912773 -0700 | |
516 | data 5 | |
517 | bump | |
518 | from :12 | |
519 | M 100644 :13 file | |
520 | ||
521 | EOF | |
522 | ||
523 | test_expect_success 'avoid uninteresting refs' ' | |
524 | > tmp-marks && | |
525 | git fast-export --import-marks=tmp-marks \ | |
526 | --export-marks=tmp-marks master > /dev/null && | |
527 | git tag v1.0 && | |
528 | git branch uninteresting && | |
529 | echo bump > file && | |
530 | git commit -a -m bump && | |
531 | git fast-export --import-marks=tmp-marks \ | |
532 | --export-marks=tmp-marks ^uninteresting ^v1.0 master > actual && | |
533 | test_cmp expected actual | |
534 | ' | |
535 | ||
f28e7c90 FC |
536 | cat > expected << EOF |
537 | reset refs/heads/master | |
538 | from :14 | |
539 | ||
540 | EOF | |
541 | ||
542 | test_expect_success 'refs are updated even if no commits need to be exported' ' | |
543 | > tmp-marks && | |
544 | git fast-export --import-marks=tmp-marks \ | |
545 | --export-marks=tmp-marks master > /dev/null && | |
546 | git fast-export --import-marks=tmp-marks \ | |
547 | --export-marks=tmp-marks master > actual && | |
548 | test_cmp expected actual | |
549 | ' | |
550 | ||
03e9010c | 551 | test_expect_success 'use refspec' ' |
a4d4e32a PK |
552 | git fast-export --refspec refs/heads/master:refs/heads/foobar master >actual2 && |
553 | grep "^commit " actual2 | sort | uniq >actual && | |
03e9010c FC |
554 | echo "commit refs/heads/foobar" > expected && |
555 | test_cmp expected actual | |
556 | ' | |
557 | ||
fdf31b63 | 558 | test_expect_success 'delete ref because entire history excluded' ' |
60ed2643 | 559 | git branch to-delete && |
fdf31b63 EN |
560 | git fast-export to-delete ^to-delete >actual && |
561 | cat >expected <<-EOF && | |
562 | reset refs/heads/to-delete | |
563 | from 0000000000000000000000000000000000000000 | |
564 | ||
565 | EOF | |
566 | test_cmp expected actual | |
567 | ' | |
568 | ||
569 | test_expect_success 'delete refspec' ' | |
570 | git fast-export --refspec :refs/heads/to-delete >actual && | |
571 | cat >expected <<-EOF && | |
60ed2643 FC |
572 | reset refs/heads/to-delete |
573 | from 0000000000000000000000000000000000000000 | |
574 | ||
575 | EOF | |
576 | test_cmp expected actual | |
577 | ' | |
578 | ||
b3e8ca89 JT |
579 | test_expect_success 'when using -C, do not declare copy when source of copy is also modified' ' |
580 | test_create_repo src && | |
581 | echo a_line >src/file.txt && | |
582 | git -C src add file.txt && | |
583 | git -C src commit -m 1st_commit && | |
584 | ||
585 | cp src/file.txt src/file2.txt && | |
586 | echo another_line >>src/file.txt && | |
587 | git -C src add file.txt file2.txt && | |
588 | git -C src commit -m 2nd_commit && | |
589 | ||
590 | test_create_repo dst && | |
a4d4e32a PK |
591 | git -C src fast-export --all -C >actual && |
592 | git -C dst fast-import <actual && | |
b3e8ca89 JT |
593 | git -C src show >expected && |
594 | git -C dst show >actual && | |
595 | test_cmp expected actual | |
596 | ' | |
597 | ||
be011bbe MÅ |
598 | test_expect_success 'merge commit gets exported with --import-marks' ' |
599 | test_create_repo merging && | |
600 | ( | |
601 | cd merging && | |
602 | test_commit initial && | |
603 | git checkout -b topic && | |
604 | test_commit on-topic && | |
605 | git checkout master && | |
606 | test_commit on-master && | |
607 | test_tick && | |
608 | git merge --no-ff -m Yeah topic && | |
609 | ||
610 | echo ":1 $(git rev-parse HEAD^^)" >marks && | |
611 | git fast-export --import-marks=marks master >out && | |
612 | grep Yeah out | |
613 | ) | |
614 | ' | |
615 | ||
f2dc849e | 616 | test_done |