* [PATCH] unresolve: make sure resolve-undo info is left even for removed paths
@ 2023-06-22 22:54 Junio C Hamano
0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2023-06-22 22:54 UTC (permalink / raw)
To: git
"git rerere forget" requires that resolve-undo information is
correctly recorded in the index.
The current rerere machinery is not even prepared to access the
resolve-undo information for paths resolved for removal, as it first
goes to the main index entry and then finds the resolve-undo
information associated to the same pathname. This has to be fixed
later (the codepath used by "git update-index --unresolve" shares
the same problem---unmerge_index_entry_at() is a flawed interface
that assumes that the index has the path in it after resolution, and
cannot be used when the resolution was to remove), but let's first
make sure we have the information recorded.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/t2030-unresolve-info.sh | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/t/t2030-unresolve-info.sh b/t/t2030-unresolve-info.sh
index 2d8c70b03a..c515b40e8d 100755
--- a/t/t2030-unresolve-info.sh
+++ b/t/t2030-unresolve-info.sh
@@ -62,6 +62,13 @@ test_expect_success setup '
test_commit fourth fi/le fourth &&
git checkout add-add &&
test_commit fifth add-differently &&
+ git checkout --detach initial &&
+ git rm binary &&
+ test_commit sixth del-binary &&
+ git reset --hard HEAD^ &&
+ printf "a\0c" >binary &&
+ git add binary &&
+ test_commit seventh mod-binary &&
git checkout main
'
@@ -126,6 +133,32 @@ test_expect_success 'unmerge with plumbing' '
test_line_count = 3 actual
'
+test_expect_success 'del-mod conflict' '
+ git reset --hard &&
+ # they delete, we modify, resolve to ours
+ git checkout --detach seventh &&
+ test_must_fail git merge sixth &&
+ git add binary &&
+ check_resolve_undo mods binary initial:binary seventh:binary ""
+'
+
+test_expect_success 'del-mod conflict' '
+ git reset --hard &&
+ # we delete, they modify, resolve to deletion
+ git checkout --detach sixth &&
+ test_must_fail git merge seventh &&
+ git rm binary &&
+ check_resolve_undo removed binary initial:binary "" seventh:binary
+'
+
+test_expect_success 'resolve 3-way conflict to deletion' '
+ git reset --hard &&
+ git checkout --detach second &&
+ test_must_fail git merge third &&
+ git rm fi/le &&
+ check_resolve_undo recorded fi/le initial:fi/le second:fi/le third:fi/le
+'
+
test_expect_success 'rerere and rerere forget' '
mkdir .git/rr-cache &&
prime_resolve_undo &&
--
2.41.0-113-g6640c2d06d
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-22 22:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-22 22:54 [PATCH] unresolve: make sure resolve-undo info is left even for removed paths Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).