]> git.ipfire.org Git - thirdparty/git.git/commit
update-index: use unmerge_index_entry() to support removal
authorJunio C Hamano <gitster@pobox.com>
Mon, 31 Jul 2023 22:44:05 +0000 (15:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 31 Jul 2023 23:02:17 +0000 (16:02 -0700)
commit35901f1c2461640019e70bbefecdce1f59f660d2
tree06ad758a9bb60b9c67ae18257e0c8e31e69a94fc
parentfe83269e16c1fd57df42c2a22a2b9ee621175a75
update-index: use unmerge_index_entry() to support removal

"update-index --unresolve" uses the unmerge_index_entry_at() that
assumes that the path to be unresolved must be in the index, which
makes it impossible to unresolve a path that was resolved as removal.

Rewrite unresolve_one() to use the unmerge_index_entry() to support
unresolving such a path.

Existing tests for "update-index --unresolve" forgot to check one
thing that tests for "checkout --merge -- paths" tested, which is to
make sure that resolve-undo record that has already been used to
recreate higher-stage index entries is removed.  Add new invocations
of "ls-files --resolve-undo" after running "update-index --unresolve"
to make sure that unresolving with update-index does remove the used
resolve-undo records.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/update-index.c
t/t2030-unresolve-info.sh