diff options
author | Elijah Newren <newren@gmail.com> | 2018-04-19 10:58:20 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-08 16:11:00 +0900 |
commit | a35edc84bdd6134d7aaa7bb0d220941154fe9e7e (patch) | |
tree | cf39677e2475ee83e407c8abb8c39542c79755d6 /t/t4042-diff-textconv-caching.sh | |
parent | t6046: testcases checking whether updates can be skipped in a merge (diff) | |
download | tgif-a35edc84bdd6134d7aaa7bb0d220941154fe9e7e.tar.xz |
merge-recursive: fix was_tracked() to quit lying with some renamed paths
In commit aacb82de3ff8 ("merge-recursive: Split was_tracked() out of
would_lose_untracked()", 2011-08-11), was_tracked() was split out of
would_lose_untracked() with the intent to provide a function that could
answer whether a path was tracked in the index before the merge. Sadly,
it instead returned whether the path was in the working tree due to having
been tracked in the index before the merge OR having been written there by
unpack_trees(). The distinction is important when renames are involved,
e.g. for a merge where:
HEAD: modifies path b
other: renames b->c
In this case, c was not tracked in the index before the merge, but would
have been added to the index at stage 0 and written to the working tree by
unpack_trees(). would_lose_untracked() is more interested in the
in-working-copy-for-either-reason behavior, while all other uses of
was_tracked() want just was-it-tracked-in-index-before-merge behavior.
Unsplit would_lose_untracked() and write a new was_tracked() function
which answers whether a path was tracked in the index before the merge
started.
This will also affect was_dirty(), helping it to return better results
since it can base answers off the original index rather than an index that
possibly only copied over some of the stat information. However,
was_dirty() will need an additional change that will be made in a
subsequent patch.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4042-diff-textconv-caching.sh')
0 files changed, 0 insertions, 0 deletions