{"thread":{"id":"27484","subject":"[PATCH] git-gui: deal with unknown files when pressing the \"Stage Changed\" button","startedAt":"2011-05-27T15:40:24Z","lastAt":"2011-05-27T15:40:24Z","messageCount":1,"participants":["Heiko Voigt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"168876","messageId":"20110527154020.GA2273@book.hvoigt.net","threadId":"27484","inReplyTo":null,"subject":"[PATCH] git-gui: deal with unknown files when pressing the \"Stage Changed\" button","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2011-05-27T15:40:24Z","receivedAt":"2011-05-27T15:40:24Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"As a shortcut the \"Stage Changed\" button can be used to stage all current\nchanges in the worktree which are not set to ignore. Previously unknown\nfiles would be ignored. The user might want to say: \"Just save everything\nin my worktree\". To support this workflow we now ask whether the user also\nwants to stage the unknown files if there are some present.\n\nSigned-off-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\n lib/index.tcl |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/lib/index.tcl b/lib/index.tcl\nindex 5d7bbf2..e38b647 100644\n--- a/lib/index.tcl\n+++ b/lib/index.tcl\n@@ -356,12 +356,21 @@ proc do_add_all {} {\n \tglobal file_states\n \n \tset paths [list]\n+\tset unknown_paths [list]\n \tforeach path [array names file_states] {\n \t\tswitch -glob -- [lindex $file_states($path) 0] {\n \t\tU? {continue}\n \t\t?M -\n \t\t?T -\n \t\t?D {lappend paths $path}\n+\t\t?O {lappend unknown_paths $path}\n+\t\t}\n+\t}\n+\tif {[llength $unknown_paths]} {\n+\t\tset reply [ask_popup [mc \"There are unknown files do you also want\n+to stage those?\"]]\n+\t\tif {$reply} {\n+\t\t\tset paths [concat $paths $unknown_paths]\n \t\t}\n \t}\n \tadd_helper {Adding all changed files} $paths\n-- \n1.7.5.1.219.g4c6b2\n"}]}