Skip to contentSkip to conversation

git-gui: Restore ability to Stage Working Copy for conflicts.

PATCH In review Alexander Gavrilov 2 participants 2 messages Jun 15, 2016 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-gui: Restore ability to Stage Working Copy for conflicts.

Tools like rerere leave files marked as conflicts in the index, while actually resolving them in the working copy. Also, some people like to use an external editor to resolve conflicts.

This patch restores functionality previously removed in commit 617ceee653 by adding a new context menu item. It still ensures that the user does not stage conflicting files accidentally by clicking on the icon instead of the name.

---
 git-gui.sh        |    5 +++++
 lib/mergetool.tcl |    6 ++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
git-gui.sh +5 -0
index d227eca..a732ef1 100755
@@ -2984,6 +2984,11 @@ $ctxmmg add command \
 	-command {merge_resolve_one 1}
 lappend diff_actions [list $ctxmmg entryconf [$ctxmmg index last] -state]
 $ctxmmg add separator
+$ctxmmg add command \
+	-label [mc "Stage Working Copy"] \
+	-command {merge_resolve_one 0}
+lappend diff_actions [list $ctxmmg entryconf [$ctxmmg index last] -state]
+$ctxmmg add separator
 create_common_diff_popup $ctxmmg
 
 proc popup_diff_menu {ctxm ctxmmg x y X Y} {
lib/mergetool.tcl +6 -0
index 79c58bc..dd2315b 100644
@@ -5,6 +5,12 @@ proc merge_resolve_one {stage} {
 	global current_diff_path
 
 	switch -- $stage {
+		0 {	# Stage without confirmation, to minimize
+			# disruption of the rerere workflow
+			merge_add_resolution $current_diff_path
+			return
+		}
+
 		1 { set target [mc "the base version"] }
 		2 { set target [mc "this branch"] }
 		3 { set target [mc "the other branch"] }
Signature · 1 line
1.6.0.20.g6148bc
Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · Alexander Gavrilov

Tools like rerere leave files marked as conflicts in the index, while actually resolving them in the working copy. Also, some people like to use an external editor to resolve conflicts.

This patch restores functionality previously removed in commit 617ceee653 by adding a new context menu item. It still ensures that the user does not stage conflicting files accidentally by clicking on the icon instead of the name.

Thanks! Works well here.

-- Hannes