git-gui: added gui.maxrecentrepo to extend the number of remembered repos

The list of recently opened repositories shown when launching git-gui from outside a repository was hard coded to only show a maximum of 10 items. This config variable allows the user to override this default. Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Pat Thoyts committed Jul 10, 2013 at 13:31 UTC a86560453ba8a81527d5d119ea8985a3269af1fa
1 file changed +10 -2
lib/choose_repository.tcl
+10 -2
@@ -24,6 +24,10 @@ field sorted_recent ; # recent repositories (sorted)
24 constructor pick {} {
25 global M1T M1B use_ttk NS
26
27 + if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} {
28 + set maxrecent 10
29 + }
30 +
31 make_dialog top w
32 wm title $top [mc "Git Gui"]
33
@@ -148,7 +152,7 @@ constructor pick {} {
152 -background [get_bg_color $w_body.recentlabel] \
153 -wrap none \
154 -width 50 \
151 - -height 10
155 + -height $maxrecent
156 $w_recentlist tag conf link \
157 -foreground blue \
158 -underline 1
@@ -264,7 +268,11 @@ proc _append_recentrepos {path} {
268 git config --global --add gui.recentrepo $path
269 load_config 1
270
267 - while {[llength $recent] > 10} {
271 + if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} {
272 + set maxrecent 10
273 + }
274 +
275 + while {[llength $recent] > $maxrecent} {
276 _unset_recentrepo [lindex $recent 0]
277 set recent [lrange $recent 1 end]
278 }