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>
Shawn O. Pearce committed
Nov 19, 2006 at 00:37 UTC
74d18d2edfc84d35b20e1b4520e496aadc14c365
1 file changed
+18
-5
git-gui
+18
-5
@@ -2387,7 +2387,7 @@ proc do_macosx_app {} {
2387
}
2388
2389
proc toggle_or_diff {w x y} {
2390
- global file_lists current_diff ui_index ui_other
2390
+ global file_states file_lists current_diff ui_index ui_other
2391
global last_clicked selected_paths
2392
2393
set pos [split [$w index @$x,$y] .]
@@ -2410,10 +2410,23 @@ proc toggle_or_diff {w x y} {
2410
} else {
2411
set after {}
2412
}
2413
- update_index \
2414
- "Including [short_path $path]" \
2415
- [list $path] \
2416
- [concat $after {set ui_status_value {Ready.}}]
2413
+ switch -glob -- [lindex $file_states($path) 0] {
2414
+ A_ -
2415
+ AO -
2416
+ M_ -
2417
+ D_ {
2418
+ update_indexinfo \
2419
+ "Removing [short_path $path] from commit" \
2420
+ [list $path] \
2421
+ [concat $after {set ui_status_value {Ready.}}]
2422
+ }
2423
+ ?? {
2424
+ update_index \
2425
+ "Including [short_path $path]" \
2426
+ [list $path] \
2427
+ [concat $after {set ui_status_value {Ready.}}]
2428
+ }
2429
+ }
2430
} else {
2431
show_diff $path $w $lno
2432
}