summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-10-12 04:34:04 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-10-12 04:34:04 (GMT)
commit69f85ffaa22c3357cbb5c3c97a621eccbdfa2bb3 (patch)
tree4da335742d5ee0bccab6878b3c5a77ebb8da88d5 /git-gui.sh
parenta0592d3f5746b41c60fee71dd8d2d27b5c813907 (diff)
downloadgit-69f85ffaa22c3357cbb5c3c97a621eccbdfa2bb3.zip
git-69f85ffaa22c3357cbb5c3c97a621eccbdfa2bb3.tar.gz
git-69f85ffaa22c3357cbb5c3c97a621eccbdfa2bb3.tar.bz2
git-gui: Move load_config procedure below git-version selection
To better handle configuration options that contain LFs in their values we want to use the new -z option available in git-config version 1.5.3 and later. To configure load_config based upon the git version we need to move thos below the git-version computation. No logic changes yet, just a minor reordering of the code. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh94
1 files changed, 49 insertions, 45 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 07be97d..530fee8 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -233,51 +233,6 @@ proc get_config {name} {
}
}
-proc load_config {include_global} {
- global repo_config global_config default_config
-
- array unset global_config
- if {$include_global} {
- catch {
- set fd_rc [git_read config --global --list]
- 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
- }
- }
-
- array unset repo_config
- catch {
- set fd_rc [git_read config --list]
- while {[gets $fd_rc line] >= 0} {
- if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
- if {[is_many_config $name]} {
- lappend repo_config($name) $value
- } else {
- set repo_config($name) $value
- }
- }
- }
- close $fd_rc
- }
-
- foreach name [array names default_config] {
- if {[catch {set v $global_config($name)}]} {
- set global_config($name) $default_config($name)
- }
- if {[catch {set v $repo_config($name)}]} {
- set repo_config($name) $default_config($name)
- }
- }
-}
-
######################################################################
##
## handy utils
@@ -791,6 +746,55 @@ unset -nocomplain idx fd
######################################################################
##
+## config file parsing
+
+proc load_config {include_global} {
+ global repo_config global_config default_config
+
+ array unset global_config
+ if {$include_global} {
+ catch {
+ set fd_rc [git_read config --global --list]
+ 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
+ }
+ }
+
+ array unset repo_config
+ catch {
+ set fd_rc [git_read config --list]
+ while {[gets $fd_rc line] >= 0} {
+ if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
+ if {[is_many_config $name]} {
+ lappend repo_config($name) $value
+ } else {
+ set repo_config($name) $value
+ }
+ }
+ }
+ close $fd_rc
+ }
+
+ foreach name [array names default_config] {
+ if {[catch {set v $global_config($name)}]} {
+ set global_config($name) $default_config($name)
+ }
+ if {[catch {set v $repo_config($name)}]} {
+ set repo_config($name) $default_config($name)
+ }
+ }
+}
+
+######################################################################
+##
## feature option selection
if {[regexp {^git-(.+)$} [file tail $argv0] _junk subcommand]} {