git-gui: deal with unknown files when pressing the "Stage Changed" button
As a shortcut the "Stage Changed" button can be used to stage all current changes in the worktree which are not set to ignore. Previously unknown files would be ignored. The user might want to say: "Just save everything in my worktree". To support this workflow we now ask whether the user also wants to stage the unknown files if there are some present. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Heiko Voigt committed
May 27, 2011 at 17:40 UTC
856c2d75c64b0e7cfc1a8d84ad5344e8b2354085
1 file changed
+9
lib/index.tcl
+9
@@ -356,12 +356,21 @@ proc do_add_all {} {
356
global file_states
357
358
set paths [list]
359
+ set unknown_paths [list]
360
foreach path [array names file_states] {
361
switch -glob -- [lindex $file_states($path) 0] {
362
U? {continue}
363
?M -
364
?T -
365
?D {lappend paths $path}
366
+ ?O {lappend unknown_paths $path}
367
+ }
368
+ }
369
+ if {[llength $unknown_paths]} {
370
+ set reply [ask_popup [mc "There are unknown files do you also want
371
+to stage those?"]]
372
+ if {$reply} {
373
+ set paths [concat $paths $unknown_paths]
374
}
375
}
376
add_helper {Adding all changed files} $paths