diff options
author | Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> | 2011-03-23 22:41:01 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-03-23 22:44:22 -0700 |
commit | d7c9bf22351e39756f93f09b4251a6b5861d9cc0 (patch) | |
tree | 91df67daf4141de1ed040cd578e6280c0a1f41fd /t/t4112-apply-renames.sh | |
parent | Merge branch 'maint-1.7.2' into maint-1.7.3 (diff) | |
download | tgif-d7c9bf22351e39756f93f09b4251a6b5861d9cc0.tar.xz |
diffcore-rename: don't consider unmerged path as source
Since e9c8409 (diff-index --cached --raw: show tree entry on the LHS for
unmerged entries., 2007-01-05), an unmerged entry should be detected by
using DIFF_PAIR_UNMERGED(p), not by noticing both one and two sides of
the filepair records mode=0 entries. However, it forgot to update some
parts of the rename detection logic.
This only makes difference in the "diff --cached" codepath where an
unmerged filepair carries information on the entries that came from the
tree. It probably hasn't been noticed for a long time because nobody
would run "diff -M" during a conflict resolution, but "git status" uses
rename detection when it internally runs "diff-index" and "diff-files"
and gives nonsense results.
In an unmerged pair, "one" side can have a valid filespec to record the
tree entry (e.g. what's in HEAD) when running "diff --cached". This can
be used as a rename source to other paths in the index that are not
unmerged. The path that is unmerged by definition does not have the
final content yet (i.e. "two" side cannot have a valid filespec), so it
can never be a rename destination.
Use the DIFF_PAIR_UNMERGED() to detect unmerged filepair correctly, and
allow the valid "one" side of an unmerged filepair to be considered a
potential rename source, but never to be considered a rename destination.
Commit message and first two test cases by Junio, the rest by Martin.
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4112-apply-renames.sh')
0 files changed, 0 insertions, 0 deletions