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>
Shawn O. Pearce committed
Oct 12, 2007 at 00:34 UTC
69f85ffaa22c3357cbb5c3c97a621eccbdfa2bb3
1 file changed
+49
-45
git-gui.sh
+49
-45
@@ -233,51 +233,6 @@ proc get_config {name} {
233
}
234
}
235
236
-proc load_config {include_global} {
237
- global repo_config global_config default_config
238
-
239
- array unset global_config
240
- if {$include_global} {
241
- catch {
242
- set fd_rc [git_read config --global --list]
243
- while {[gets $fd_rc line] >= 0} {
244
- if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
245
- if {[is_many_config $name]} {
246
- lappend global_config($name) $value
247
- } else {
248
- set global_config($name) $value
249
- }
250
- }
251
- }
252
- close $fd_rc
253
- }
254
- }
255
-
256
- array unset repo_config
257
- catch {
258
- set fd_rc [git_read config --list]
259
- while {[gets $fd_rc line] >= 0} {
260
- if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
261
- if {[is_many_config $name]} {
262
- lappend repo_config($name) $value
263
- } else {
264
- set repo_config($name) $value
265
- }
266
- }
267
- }
268
- close $fd_rc
269
- }
270
-
271
- foreach name [array names default_config] {
272
- if {[catch {set v $global_config($name)}]} {
273
- set global_config($name) $default_config($name)
274
- }
275
- if {[catch {set v $repo_config($name)}]} {
276
- set repo_config($name) $default_config($name)
277
- }
278
- }
279
-}
280
-
236
######################################################################
237
##
238
## handy utils
@@ -789,6 +744,55 @@ if {$idx ne {}} {
744
}
745
unset -nocomplain idx fd
746
747
+######################################################################
748
+##
749
+## config file parsing
750
+
751
+proc load_config {include_global} {
752
+ global repo_config global_config default_config
753
+
754
+ array unset global_config
755
+ if {$include_global} {
756
+ catch {
757
+ set fd_rc [git_read config --global --list]
758
+ while {[gets $fd_rc line] >= 0} {
759
+ if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
760
+ if {[is_many_config $name]} {
761
+ lappend global_config($name) $value
762
+ } else {
763
+ set global_config($name) $value
764
+ }
765
+ }
766
+ }
767
+ close $fd_rc
768
+ }
769
+ }
770
+
771
+ array unset repo_config
772
+ catch {
773
+ set fd_rc [git_read config --list]
774
+ while {[gets $fd_rc line] >= 0} {
775
+ if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
776
+ if {[is_many_config $name]} {
777
+ lappend repo_config($name) $value
778
+ } else {
779
+ set repo_config($name) $value
780
+ }
781
+ }
782
+ }
783
+ close $fd_rc
784
+ }
785
+
786
+ foreach name [array names default_config] {
787
+ if {[catch {set v $global_config($name)}]} {
788
+ set global_config($name) $default_config($name)
789
+ }
790
+ if {[catch {set v $repo_config($name)}]} {
791
+ set repo_config($name) $default_config($name)
792
+ }
793
+ }
794
+}
795
+
796
######################################################################
797
##
798
## feature option selection