summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-07-30 00:29:52 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-07-30 03:44:51 (GMT)
commit37e2199c4c5b45e060f973097d814726cabe2a86 (patch)
tree229c4a2dce08c358e14c5bbe94a22ac51c6484f9 /git-gui.sh
parent95af4d8de16e8e681c196fce6d42e40909933115 (diff)
downloadgit-37e2199c4c5b45e060f973097d814726cabe2a86.zip
git-37e2199c4c5b45e060f973097d814726cabe2a86.tar.gz
git-37e2199c4c5b45e060f973097d814726cabe2a86.tar.bz2
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>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 4e3b58c..0180756 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -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