Commit b3e8ca8
fast-export: do not copy from modified file
When run with the "-C" option, fast-export writes 'C' commands in its
output whenever the internal diff mechanism detects a file copy,
indicating that fast-import should copy the given existing file to the
given new filename. However, the diff mechanism works against the
prior version of the file, whereas fast-import uses whatever is current.
This causes issues when a commit both modifies a file and uses it as the
source for a copy.
Therefore, teach fast-export to refrain from writing 'C' when it has
already written a modification command for a file.
An existing test in t9350-fast-export is also fixed in this patch. The
existing line "C file6 file7" copies the wrong version of file6, but it
has coincidentally worked because file7 was subsequently overridden.
Reported-by: Juraj Oršulić <juraj.orsulic@fer.hr>
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 3b82744 commit b3e8ca8
2 files changed
Lines changed: 51 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
| |||
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
| 361 | + | |
360 | 362 | | |
361 | 363 | | |
362 | 364 | | |
363 | 365 | | |
364 | 366 | | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
374 | 386 | | |
375 | 387 | | |
376 | 388 | | |
| |||
391 | 403 | | |
392 | 404 | | |
393 | 405 | | |
| 406 | + | |
394 | 407 | | |
395 | 408 | | |
396 | 409 | | |
| |||
526 | 539 | | |
527 | 540 | | |
528 | 541 | | |
529 | | - | |
| 542 | + | |
| 543 | + | |
530 | 544 | | |
531 | 545 | | |
532 | 546 | | |
| |||
613 | 627 | | |
614 | 628 | | |
615 | 629 | | |
| 630 | + | |
616 | 631 | | |
617 | 632 | | |
618 | 633 | | |
| |||
628 | 643 | | |
629 | 644 | | |
630 | 645 | | |
631 | | - | |
| 646 | + | |
| 647 | + | |
632 | 648 | | |
633 | 649 | | |
634 | 650 | | |
635 | 651 | | |
636 | 652 | | |
637 | 653 | | |
638 | | - | |
| 654 | + | |
639 | 655 | | |
640 | 656 | | |
641 | 657 | | |
| |||
975 | 991 | | |
976 | 992 | | |
977 | 993 | | |
| 994 | + | |
978 | 995 | | |
979 | 996 | | |
980 | 997 | | |
| |||
1047 | 1064 | | |
1048 | 1065 | | |
1049 | 1066 | | |
| 1067 | + | |
1050 | 1068 | | |
1051 | 1069 | | |
1052 | 1070 | | |
1053 | 1071 | | |
1054 | 1072 | | |
1055 | 1073 | | |
1056 | | - | |
1057 | | - | |
| 1074 | + | |
| 1075 | + | |
1058 | 1076 | | |
1059 | 1077 | | |
1060 | 1078 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
525 | 543 | | |
0 commit comments