{"thread":{"id":"59900","subject":"[PATCH] unresolve: make sure resolve-undo info is left even for removed paths","startedAt":"2023-06-22T22:54:55Z","lastAt":"2023-06-22T22:54:55Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"478716","messageId":"xmqqzg4rcdlb.fsf@gitster.g","threadId":"59900","inReplyTo":null,"subject":"[PATCH] unresolve: make sure resolve-undo info is left even for removed paths","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-06-22T22:54:40Z","receivedAt":"2023-06-22T22:54:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"git rerere forget\" requires that resolve-undo information is\ncorrectly recorded in the index.\n\nThe current rerere machinery is not even prepared to access the\nresolve-undo information for paths resolved for removal, as it first\ngoes to the main index entry and then finds the resolve-undo\ninformation associated to the same pathname.  This has to be fixed\nlater (the codepath used by \"git update-index --unresolve\" shares\nthe same problem---unmerge_index_entry_at() is a flawed interface\nthat assumes that the index has the path in it after resolution, and\ncannot be used when the resolution was to remove), but let's first\nmake sure we have the information recorded.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t2030-unresolve-info.sh | 33 +++++++++++++++++++++++++++++++++\n 1 file changed, 33 insertions(+)\n\ndiff --git a/t/t2030-unresolve-info.sh b/t/t2030-unresolve-info.sh\nindex 2d8c70b03a..c515b40e8d 100755\n--- a/t/t2030-unresolve-info.sh\n+++ b/t/t2030-unresolve-info.sh\n@@ -62,6 +62,13 @@ test_expect_success setup '\n \ttest_commit fourth fi/le fourth &&\n \tgit checkout add-add &&\n \ttest_commit fifth add-differently &&\n+\tgit checkout --detach initial &&\n+\tgit rm binary &&\n+\ttest_commit sixth del-binary &&\n+\tgit reset --hard HEAD^ &&\n+\tprintf \"a\\0c\" >binary &&\n+\tgit add binary &&\n+\ttest_commit seventh mod-binary &&\n \tgit checkout main\n '\n \n@@ -126,6 +133,32 @@ test_expect_success 'unmerge with plumbing' '\n \ttest_line_count = 3 actual\n '\n \n+test_expect_success 'del-mod conflict' '\n+\tgit reset --hard &&\n+\t# they delete, we modify, resolve to ours\n+\tgit checkout --detach seventh &&\n+\ttest_must_fail git merge sixth &&\n+\tgit add binary &&\n+\tcheck_resolve_undo mods binary initial:binary seventh:binary \"\"\n+'\n+\n+test_expect_success 'del-mod conflict' '\n+\tgit reset --hard &&\n+\t# we delete, they modify, resolve to deletion\n+\tgit checkout --detach sixth &&\n+\ttest_must_fail git merge seventh &&\n+\tgit rm binary &&\n+\tcheck_resolve_undo removed binary initial:binary \"\" seventh:binary\n+'\n+\n+test_expect_success 'resolve 3-way conflict to deletion' '\n+\tgit reset --hard &&\n+\tgit checkout --detach second &&\n+\ttest_must_fail git merge third &&\n+\tgit rm fi/le &&\n+\tcheck_resolve_undo recorded fi/le initial:fi/le second:fi/le third:fi/le\n+'\n+\n test_expect_success 'rerere and rerere forget' '\n \tmkdir .git/rr-cache &&\n \tprime_resolve_undo &&\n-- \n2.41.0-113-g6640c2d06d\n\n"}]}