summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 881d8f2)
raw | patch | inline | side by side (parent: 881d8f2)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 2 Sep 2007 19:38:04 +0000 (15:38 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 4 Sep 2007 03:03:52 +0000 (23:03 -0400) |
Today I found yet another way for the "Stage Hunk" and "Unstage
Hunk" context menu actions to leave the wrong state enabled in
the UI. The problem this time was that I connected the state
determination to the value of $::current_diff_side (the side the
diff is from). When the user was last looking at a diff from the
index side and unstages everything the diff panel goes empty, but
the action stayed enabled as we always assumed unstaging was a
valid action.
This change moves the logic for determining when the action is
enabled away from the individual side selection, as they really
are two unrelated concepts.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Hunk" context menu actions to leave the wrong state enabled in
the UI. The problem this time was that I connected the state
determination to the value of $::current_diff_side (the side the
diff is from). When the user was last looking at a diff from the
index side and unstages everything the diff panel goes empty, but
the action stayed enabled as we always assumed unstaging was a
valid action.
This change moves the logic for determining when the action is
enabled away from the individual side selection, as they really
are two unrelated concepts.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index e495046c3b9a99106e8fa3506aad45bd911dd5c8..44977aa2124c034f3711548763cd6a69a2c52c77 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
set ::cursorX $x
set ::cursorY $y
if {$::ui_index eq $::current_diff_side} {
- set s normal
set l "Unstage Hunk From Commit"
} else {
- if {$current_diff_path eq {}
- || ![info exists file_states($current_diff_path)]
- || {_O} eq [lindex $file_states($current_diff_path) 0]} {
- set s disabled
- } else {
- set s normal
- }
set l "Stage Hunk For Commit"
}
- if {$::is_3way_diff} {
+ if {$::is_3way_diff
+ || $current_diff_path eq {}
+ || ![info exists file_states($current_diff_path)]
+ || {_O} eq [lindex $file_states($current_diff_path) 0]} {
set s disabled
+ } else {
+ set s normal
}
$ctxm entryconf $::ui_diff_applyhunk -state $s -label $l
tk_popup $ctxm $X $Y