Skip to content

Commit 9c9f5fa

Browse files
committed
git-gui: Do not offer to stage three-way diff hunks into the index
git-apply does not accept a patch that was generated as a three-way combined diff format such as we see during merge conflicts. If we get such a diff in our diff viewer and try to send it to git-apply it just errors out and the user is left confused wondering why they cannot stage that hunk. Instead of feeding a known to be unacceptable hunk to git-apply we now just disable the stage/unstage context menu option if the hunk came from a three way diff. The user may still be confused about why they cannot work with a combined diff, but at least they are only confused as to why git-gui is not offering them the action. Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 9f4119e commit 9c9f5fa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

git-gui.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,7 @@ set empty_tree {}
738738
set current_branch {}
739739
set is_detached 0
740740
set current_diff_path {}
741+
set is_3way_diff 0
741742
set selected_commit_type new
742743

743744
######################################################################
@@ -2444,6 +2445,9 @@ proc popup_diff_menu {ctxm x y X Y} {
24442445
}
24452446
set l "Stage Hunk For Commit"
24462447
}
2448+
if {$::is_3way_diff} {
2449+
set s disabled
2450+
}
24472451
$ctxm entryconf $::ui_diff_applyhunk -state $s -label $l
24482452
tk_popup $ctxm $X $Y
24492453
}

0 commit comments

Comments
 (0)