summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-20 23:10:30 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-21 02:54:23 -0500
commitde5f6d5d178a1c8113aaca34c8f6b3842732a741 (patch)
tree010071e9d36c1319d4e74dc73c10704f674adb9c /git-gui.sh
parentgit-gui: Refactor add/remove proc names to align with reality. (diff)
downloadtgif-de5f6d5d178a1c8113aaca34c8f6b3842732a741.tar.xz
git-gui: Add or unstage based on the specific icon used.
Rather than relying on the file state and just inverting it, we should look at which file icon the user clicked on. If they clicked on the one in the "Changes To Be Committed" list then they want to unstage the file. If they clicked on the icon in the "Changed But Not Updated" list then they want to add the file to the commit. This should be much more reliable about capturing the user's intent then looking at the file state. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh10
1 files changed, 2 insertions, 8 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 84ec57366c..c1ee48bf07 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2867,23 +2867,17 @@ proc toggle_or_diff {w x y} {
} else {
set after {}
}
- switch -glob -- [lindex $file_states($path) 0] {
- A_ -
- M_ -
- D_ -
- DO {
+ if {$w eq $ui_index} {
update_indexinfo \
"Unstaging [short_path $path] from commit" \
[list $path] \
[concat $after {set ui_status_value {Ready.}}]
- }
- ?? {
+ } elseif {$w eq $ui_workdir} {
update_index \
"Adding [short_path $path]" \
[list $path] \
[concat $after {set ui_status_value {Ready.}}]
}
- }
} else {
show_diff $path $w $lno
}