@matheusbsbs / matheus-bagliano / commits / 37e2199c4c
Fork 0

git-gui: Don't offer to stage hunks from untracked files

If the user looks at an untracked file in our diff pane we used to offer "Stage Hunk For Commit" in the context menu when they right-clicked in that pane. The problem is we don't actually have any diff hunks in untracked files, so there is nothing to really select for staging. So we now grey out the menu item, so the user cannot invoke it and think its broken when it does not perform any useful action. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jul 29, 2007 at 20:29 UTC 37e2199c4c5b45e060f973097d814726cabe2a86
1 file changed +6
git-gui.sh
+6
@@ -2437,9 +2437,15 @@ proc popup_diff_menu {ctxm x y X Y} {
2437 set ::cursorY $y
2438 if {$::ui_index eq $::current_diff_side} {
2439 $ctxm entryconf $::ui_diff_applyhunk \
2440 + -state normal \
2441 -label {Unstage Hunk From Commit}
2442 + } elseif {{_O} eq [lindex $::file_states($::current_diff_path) 0]} {
2443 + $ctxm entryconf $::ui_diff_applyhunk \
2444 + -state disabled \
2445 + -label {Stage Hunk For Commit}
2446 } else {
2447 $ctxm entryconf $::ui_diff_applyhunk \
2448 + -state normal \
2449 -label {Stage Hunk For Commit}
2450 }
2451 tk_popup $ctxm $X $Y