Skip to content

Commit 2fe5b2e

Browse files
angavrilovspearce
authored andcommitted
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 617ceee 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. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Tested-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Shawn O. Pearce <sop@google.com>
1 parent a9786bb commit 2fe5b2e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

git-gui.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2902,6 +2902,11 @@ $ctxmmg add command \
29022902
-command {merge_resolve_one 1}
29032903
lappend diff_actions [list $ctxmmg entryconf [$ctxmmg index last] -state]
29042904
$ctxmmg add separator
2905+
$ctxmmg add command \
2906+
-label [mc "Stage Working Copy"] \
2907+
-command {merge_resolve_one 0}
2908+
lappend diff_actions [list $ctxmmg entryconf [$ctxmmg index last] -state]
2909+
$ctxmmg add separator
29052910
create_common_diff_popup $ctxmmg
29062911
29072912
proc popup_diff_menu {ctxm ctxmmg x y X Y} {

lib/mergetool.tcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ proc merge_resolve_one {stage} {
55
global current_diff_path
66

77
switch -- $stage {
8+
0 { # Stage without confirmation, to minimize
9+
# disruption of the rerere workflow
10+
merge_add_resolution $current_diff_path
11+
return
12+
}
13+
814
1 { set target [mc "the base version"] }
915
2 { set target [mc "this branch"] }
1016
3 { set target [mc "the other branch"] }

0 commit comments

Comments
 (0)