@matheusbsbs / matheus-bagliano / commits / 6bbd1cb95a
Fork 0

git-gui: Don't load the global options unless necessary.

Since git-repo-config will supply us a union of both the global and the local repository configuration data when we invoke it during startup there is no reason to go get the global configuration with an extra call to repo-config unless the user is trying to view & edit all options in the options dialog. Since skipping this extra repo-config invocation save us a little bit of time its nice to be able to avoid it when we are invoked as git-citool and won't be running very long. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Nov 12, 2006 at 16:24 UTC 6bbd1cb95aede2991d0748d2a54088f2c1291602
1 file changed +16 -13
git-gui
+16 -13
@@ -24,24 +24,27 @@ proc is_many_config {name} {
24 }
25 }
26
27 -proc load_config {} {
27 +proc load_config {include_global} {
28 global repo_config global_config default_config
29
30 array unset global_config
31 - array unset repo_config
32 - catch {
33 - set fd_rc [open "| git repo-config --global --list" r]
34 - while {[gets $fd_rc line] >= 0} {
35 - if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
36 - if {[is_many_config $name]} {
37 - lappend global_config($name) $value
38 - } else {
39 - set global_config($name) $value
31 + if {$include_global} {
32 + catch {
33 + set fd_rc [open "| git repo-config --global --list" r]
34 + while {[gets $fd_rc line] >= 0} {
35 + if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
36 + if {[is_many_config $name]} {
37 + lappend global_config($name) $value
38 + } else {
39 + set global_config($name) $value
40 + }
41 }
42 }
43 + close $fd_rc
44 }
43 - close $fd_rc
45 }
46 +
47 + array unset repo_config
48 catch {
49 set fd_rc [open "| git repo-config --list" r]
50 while {[gets $fd_rc line] >= 0} {
@@ -1711,7 +1714,7 @@ proc do_options {} {
1714 global repo_config global_config
1715 global repo_config_new global_config_new
1716
1714 - load_config
1717 + load_config 1
1718 array unset repo_config_new
1719 array unset global_config_new
1720 foreach name [array names repo_config] {
@@ -1919,7 +1922,7 @@ set font_descs {
1922 {fontui font_ui {Main Font}}
1923 {fontdiff font_diff {Diff/Console Font}}
1924 }
1922 -load_config
1925 +load_config 0
1926 apply_config
1927
1928 ######################################################################