aboutsummaryrefslogtreecommitdiff
path: root/docs/RelNotes
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2022-02-13 22:40:42 -0500
committerKyle Meyer <kyle@kyleam.com>2022-02-16 22:49:49 -0500
commitf9a15cb349b24ce705cae3dde646a1e027dc54d5 (patch)
tree98060fc5db7ffb564c2d51cb51915aa1eab6b9ba /docs/RelNotes
parentefe590bb4f1020cf8e9503e564a84f569f5ba82e (diff)
magit-discard-files: Account for 'renamed on both sides' conflicts
Merging two lines that both renamed a file leads to a conflict like this: DD f AU f-rename UA f-rename-side In the status buffer, that shows up as three staged entries: Staged changes (3) unmerged f (both deleted) unmerged f-rename (added by us) unmerged f-rename-side (added by them) For conflicts in the staged section, calling magit-discard to trigger magit-discard-files--resolve/magit-checkout-stage is useful for letting the caller choose a side's variant. However, that doesn't work for the entries above: * On the first entry, magit-discard-files--delete is called rather than magit-discard-files--resolve/magit-checkout-stage, and it fails trying to delete a working tree file that isn't there. * On the second and third entries, calling magit-discard does go down the magit-discard-files--resolve/magit-checkout-stage path. That works as expected when choosing the side with the file in its tree (e.g., choosing "ours" for f-rename above). However, choosing the other side leads to the 'git checkout --ours/theirs' call failing because the file doesn't exist on that side. Fix magit-discard on the first entry by sending DD entries to magit-discard-files--resolve rather than magit-discard-files--delete. Asking the caller to choose a side is a bit odd because either side is equivalent, but it's probably an uncommon enough case that it's not worth adding dedicated handling for it. Fix magit-discard on the second and third entries by teaching magit-checkout-stage go down the 'git rm' path if it sees UA/AU for the side the does not have the file in its tree. Fixes #4225.
Diffstat (limited to 'docs/RelNotes')
-rw-r--r--docs/RelNotes/3.4.0.org3
1 files changed, 3 insertions, 0 deletions
diff --git a/docs/RelNotes/3.4.0.org b/docs/RelNotes/3.4.0.org
index a46e266..cc0c0aa 100644
--- a/docs/RelNotes/3.4.0.org
+++ b/docs/RelNotes/3.4.0.org
@@ -45,3 +45,6 @@
- For Helm users, calling ~magit-stash-drop~ on the "Stashes" section
has been broken since v3.0.0. #4571
+
+- ~magit-discard~ didn't properly handle conflicts resulting from a
+ file being renamed on both sides. #4225