Code

Merge branch 'bw/searching' gitgui-0.15.0
authorPat Thoyts <patthoyts@users.sourceforge.net>
Wed, 19 Oct 2011 12:35:30 +0000 (13:35 +0100)
committerPat Thoyts <patthoyts@users.sourceforge.net>
Wed, 19 Oct 2011 12:35:30 +0000 (13:35 +0100)
git-gui.sh
lib/index.tcl
lib/option.tcl

index 33ab5dc3d61d67cc25fc702a62e2f998c3d71d28..21033cb0bb373be19e8593683d88ebb33cba73d7 100755 (executable)
@@ -863,6 +863,7 @@ set font_descs {
        {fontui   font_ui   {mc "Main Font"}}
        {fontdiff font_diff {mc "Diff/Console Font"}}
 }
+set default_config(gui.stageuntracked) ask
 
 ######################################################################
 ##
index e38b647b71ea335d6771121cfd079de919ced55b..8efbbdde21123dd65412cd5fe6dbb506966b0af9 100644 (file)
@@ -356,21 +356,33 @@ proc do_add_all {} {
        global file_states
 
        set paths [list]
-       set unknown_paths [list]
+       set untracked_paths [list]
        foreach path [array names file_states] {
                switch -glob -- [lindex $file_states($path) 0] {
                U? {continue}
                ?M -
                ?T -
                ?D {lappend paths $path}
-               ?O {lappend unknown_paths $path}
+               ?O {lappend untracked_paths $path}
                }
        }
-       if {[llength $unknown_paths]} {
-               set reply [ask_popup [mc "There are unknown files do you also want
-to stage those?"]]
+       if {[llength $untracked_paths]} {
+               set reply 0
+               switch -- [get_config gui.stageuntracked] {
+               no {
+                       set reply 0
+               }
+               yes {
+                       set reply 1
+               }
+               ask -
+               default {
+                       set reply [ask_popup [mc "Stage %d untracked files?" \
+                                                                         [llength $untracked_paths]]]
+               }
+               }
                if {$reply} {
-                       set paths [concat $paths $unknown_paths]
+                       set paths [concat $paths $untracked_paths]
                }
        }
        add_helper {Adding all changed files} $paths
index 3807c8d28324a277204db9191e99ddb856041c22..719103a4220cd3b84734c37e78e32773a8f23a47 100644 (file)
@@ -156,6 +156,7 @@ proc do_options {} {
                {i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}}
                {t gui.newbranchtemplate {mc "New Branch Name Template"}}
                {c gui.encoding {mc "Default File Contents Encoding"}}
+               {s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}}
                } {
                set type [lindex $option 0]
                set name [lindex $option 1]
@@ -208,6 +209,23 @@ proc do_options {} {
                                }
                                pack $w.$f.$optid -side top -anchor w -fill x
                        }
+                       s {
+                               set opts [eval [lindex $option 3]]
+                               ${NS}::frame $w.$f.$optid
+                               ${NS}::label $w.$f.$optid.l -text "$text:"
+                               if {$use_ttk} {
+                                       ttk::combobox $w.$f.$optid.v \
+                                               -textvariable ${f}_config_new($name) \
+                                               -values $opts -state readonly
+                               } else {
+                                       eval tk_optionMenu $w.$f.$optid.v \
+                                               ${f}_config_new($name) \
+                                               $opts
+                               }
+                               pack $w.$f.$optid.l -side left -anchor w -fill x
+                               pack $w.$f.$optid.v -side right -anchor e -padx 5
+                               pack $w.$f.$optid -side top -anchor w -fill x
+                       }
                        }
                }
        }