git-gui: Make consecutive icon clicks toggle included status of a file.

If the user clicks on the icon associated with a file we now flip to the
inverse status.  Partially included files first fully include, then fully
uninclude, as we don't keep track of intermediate partial inclusions.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Shawn O. Pearce 2006-11-19 00:37:49 -05:00
parent 1461c5f3d0
commit 74d18d2edf

23
git-gui
View File

@ -2387,7 +2387,7 @@ proc do_macosx_app {} {
} }
proc toggle_or_diff {w x y} { proc toggle_or_diff {w x y} {
global file_lists current_diff ui_index ui_other global file_states file_lists current_diff ui_index ui_other
global last_clicked selected_paths global last_clicked selected_paths
set pos [split [$w index @$x,$y] .] set pos [split [$w index @$x,$y] .]
@ -2410,10 +2410,23 @@ proc toggle_or_diff {w x y} {
} else { } else {
set after {} set after {}
} }
update_index \ switch -glob -- [lindex $file_states($path) 0] {
"Including [short_path $path]" \ A_ -
[list $path] \ AO -
[concat $after {set ui_status_value {Ready.}}] M_ -
D_ {
update_indexinfo \
"Removing [short_path $path] from commit" \
[list $path] \
[concat $after {set ui_status_value {Ready.}}]
}
?? {
update_index \
"Including [short_path $path]" \
[list $path] \
[concat $after {set ui_status_value {Ready.}}]
}
}
} else { } else {
show_diff $path $w $lno show_diff $path $w $lno
} }