]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-gui.sh
git-gui: Add or unstage based on the specific icon used.
[git.git] / git-gui.sh
index 84ec57366cf7c8f22452977fd691592d40acc0be..c1ee48bf07ede83bdf730688ed839300a2fa8245 100755 (executable)
@@ -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
        }