]> git.ipfire.org Git - thirdparty/git.git/commit
fast-export: do not copy from modified file
authorJonathan Tan <jonathantanmy@google.com>
Wed, 20 Sep 2017 23:55:02 +0000 (16:55 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Sep 2017 04:12:52 +0000 (13:12 +0900)
commitb3e8ca89cfe34712a093c37fdbac7df7eaae91e7
treeef77300c2853291f1825327c7546748563f694d1
parent3b827444811d7eddeddd44850f5dbbb4d59747f5
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>
builtin/fast-export.c
t/t9350-fast-export.sh