diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2006-11-12 16:24:52 -0500 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2006-11-13 00:10:38 -0500 |
commit | 6bbd1cb95aede2991d0748d2a54088f2c1291602 (patch) | |
tree | c147a791fa46e92eb8e602ac98e3ea9f451926ca /git-gui | |
parent | git-gui: Hide non-commit related commands when invoked as git-citool. (diff) | |
download | tgif-6bbd1cb95aede2991d0748d2a54088f2c1291602.tar.xz |
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>
Diffstat (limited to 'git-gui')
-rwxr-xr-x | git-gui | 29 |
1 files changed, 16 insertions, 13 deletions
@@ -24,24 +24,27 @@ proc is_many_config {name} { } } -proc load_config {} { +proc load_config {include_global} { global repo_config global_config default_config array unset global_config - array unset repo_config - catch { - set fd_rc [open "| git repo-config --global --list" r] - while {[gets $fd_rc line] >= 0} { - if {[regexp {^([^=]+)=(.*)$} $line line name value]} { - if {[is_many_config $name]} { - lappend global_config($name) $value - } else { - set global_config($name) $value + if {$include_global} { + catch { + set fd_rc [open "| git repo-config --global --list" r] + while {[gets $fd_rc line] >= 0} { + if {[regexp {^([^=]+)=(.*)$} $line line name value]} { + if {[is_many_config $name]} { + lappend global_config($name) $value + } else { + set global_config($name) $value + } } } + close $fd_rc } - close $fd_rc } + + array unset repo_config catch { set fd_rc [open "| git repo-config --list" r] while {[gets $fd_rc line] >= 0} { @@ -1711,7 +1714,7 @@ proc do_options {} { global repo_config global_config global repo_config_new global_config_new - load_config + load_config 1 array unset repo_config_new array unset global_config_new foreach name [array names repo_config] { @@ -1919,7 +1922,7 @@ set font_descs { {fontui font_ui {Main Font}} {fontdiff font_diff {Diff/Console Font}} } -load_config +load_config 0 apply_config ###################################################################### |