]> git.ipfire.org Git - thirdparty/git.git/commit - resolve-undo.c
checkout: allow "checkout -m path" to unmerge removed paths
authorJunio C Hamano <gitster@pobox.com>
Mon, 31 Jul 2023 22:44:09 +0000 (15:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 31 Jul 2023 23:16:44 +0000 (16:16 -0700)
commit5bdedac3c7b0894643256304cd5f0dd29cf8eec9
tree13fdeb61cb4c728dee967e02909f7bf1e757f857
parented3789f2f0ab8b8d5e325e47f0caf02b6bd9edfc
checkout: allow "checkout -m path" to unmerge removed paths

"git checkout -m -- path" uses the unmerge_marked_index() API, whose
implementation is incapable of unresolving a path that was resolved
as removed.  Extend the unmerge_index() API function so that we can
mark the ce_flags member of the cache entries we add to the index as
unmerged, and replace use of unmerge_marked_index() with it.

Now, together with its unmerge_index_entry_at() helper function,
unmerge_marked_index() function is no longer called by anybody, and
can safely be removed.

This makes two known test failures in t2070 and t7201 to succeed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c
builtin/update-index.c
rerere.c
resolve-undo.c
resolve-undo.h
t/t2070-restore.sh
t/t7201-co.sh