git-gui: new config to control staging of untracked files

The default is the current "ask". Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Bert Wesarg committed Oct 14, 2011 at 21:25 UTC bb196e2619652f02f3459ad9464a18ccdebe3ebf
3 files changed +32 -1
git-gui.sh
+1
@@ -859,6 +859,7 @@ set font_descs {
859 {fontui font_ui {mc "Main Font"}}
860 {fontdiff font_diff {mc "Diff/Console Font"}}
861 }
862 +set default_config(gui.stageuntracked) ask
863
864 ######################################################################
865 ##
lib/index.tcl
+13 -1
@@ -367,7 +367,19 @@ proc do_add_all {} {
367 }
368 }
369 if {[llength $untracked_paths]} {
370 - set reply [ask_popup [mc "Stage also untracked files?"]]
370 + set reply 0
371 + switch -- [get_config gui.stageuntracked] {
372 + no {
373 + set reply 0
374 + }
375 + yes {
376 + set reply 1
377 + }
378 + ask -
379 + default {
380 + set reply [ask_popup [mc "Stage also untracked files?"]]
381 + }
382 + }
383 if {$reply} {
384 set paths [concat $paths $untracked_paths]
385 }
lib/option.tcl
+18
@@ -156,6 +156,7 @@ proc do_options {} {
156 {i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}}
157 {t gui.newbranchtemplate {mc "New Branch Name Template"}}
158 {c gui.encoding {mc "Default File Contents Encoding"}}
159 + {s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}}
160 } {
161 set type [lindex $option 0]
162 set name [lindex $option 1]
@@ -208,6 +209,23 @@ proc do_options {} {
209 }
210 pack $w.$f.$optid -side top -anchor w -fill x
211 }
212 + s {
213 + set opts [eval [lindex $option 3]]
214 + ${NS}::frame $w.$f.$optid
215 + ${NS}::label $w.$f.$optid.l -text "$text:"
216 + if {$use_ttk} {
217 + ttk::combobox $w.$f.$optid.v \
218 + -textvariable ${f}_config_new($name) \
219 + -values $opts -state readonly
220 + } else {
221 + eval tk_optionMenu $w.$f.$optid.v \
222 + ${f}_config_new($name) \
223 + $opts
224 + }
225 + pack $w.$f.$optid.l -side left -anchor w -fill x
226 + pack $w.$f.$optid.v -side right -anchor e -padx 5
227 + pack $w.$f.$optid -side top -anchor w -fill x
228 + }
229 }
230 }
231 }