зеркало из https://github.com/microsoft/git.git
git-gui: Paper bag fix "Stage Hunk For Commit" in diff context menu
In a13ee29b97
I totally broke the
"Stage Hunk For Commit" feature by making this menu item always
appear in a disabled state, so it was never invokable. A "teaser
feature", just sitting there taunting the poor user who has become
used to having it available.
The issue caused by a13ee was I added a test to look at the data
in $file_states, but I didn't do that test correctly as it was
always looking at a procedure local $file_states array, which is
not defined, so the test was always true and we always disabled
the menu entry.
Instead we only want to disable the menu entry if the current file
we are looking at has no file state information (git-gui is just a
very confused little process) or it is an untracked file (and we
cannot stage individual hunks).
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Родитель
18a01a0da4
Коммит
ce015c213f
|
@ -2416,15 +2416,16 @@ $ctxm add separator
|
|||
$ctxm add command -label {Options...} \
|
||||
-command do_options
|
||||
proc popup_diff_menu {ctxm x y X Y} {
|
||||
global current_diff_path
|
||||
global current_diff_path file_states
|
||||
set ::cursorX $x
|
||||
set ::cursorY $y
|
||||
if {$::ui_index eq $::current_diff_side} {
|
||||
$ctxm entryconf $::ui_diff_applyhunk \
|
||||
-state normal \
|
||||
-label {Unstage Hunk From Commit}
|
||||
} elseif {![info exists file_states($current_diff_path)]
|
||||
|| {_O} eq [lindex $file_states($::current_diff_path) 0]} {
|
||||
} elseif {$current_diff_path eq {}
|
||||
|| ![info exists file_states($current_diff_path)]
|
||||
|| {_O} eq [lindex $file_states($current_diff_path) 0]} {
|
||||
$ctxm entryconf $::ui_diff_applyhunk \
|
||||
-state disabled \
|
||||
-label {Stage Hunk For Commit}
|
||||
|
|
Загрузка…
Ссылка в новой задаче