Skip to content

Commit

Permalink
git-gui: Don't offer to stage hunks from untracked files
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce committed Jul 30, 2007
1 parent 95af4d8 commit 37e2199
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2437,9 +2437,15 @@ proc popup_diff_menu {ctxm x y X Y} {
set ::cursorY $y
if {$::ui_index eq $::current_diff_side} {
$ctxm entryconf $::ui_diff_applyhunk \
-state normal \
-label {Unstage Hunk From Commit}
} elseif {{_O} eq [lindex $::file_states($::current_diff_path) 0]} {
$ctxm entryconf $::ui_diff_applyhunk \
-state disabled \
-label {Stage Hunk For Commit}
} else {
$ctxm entryconf $::ui_diff_applyhunk \
-state normal \
-label {Stage Hunk For Commit}
}
tk_popup $ctxm $X $Y
Expand Down

0 comments on commit 37e2199

Please sign in to comment.