git-gui: handle config booleans without value

When git interprets a config variable without a value as bool it is considered as true. But git-gui doesn't so until yet. The value for boolean configs are also case-insensitive. Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Bert Wesarg committed Oct 14, 2011 at 10:14 UTC 12b219f7f95f2d089e49140dcb1c2dd6259ff5cf
1 file changed +14 -2
git-gui.sh
+14 -2
@@ -299,7 +299,9 @@ proc is_config_true {name} {
299 global repo_config
300 if {[catch {set v $repo_config($name)}]} {
301 return 0
302 - } elseif {$v eq {true} || $v eq {1} || $v eq {yes}} {
302 + }
303 + set v [string tolower $v]
304 + if {$v eq {} || $v eq {true} || $v eq {1} || $v eq {yes} || $v eq {on}} {
305 return 1
306 } else {
307 return 0
@@ -310,7 +312,9 @@ proc is_config_false {name} {
312 global repo_config
313 if {[catch {set v $repo_config($name)}]} {
314 return 0
313 - } elseif {$v eq {false} || $v eq {0} || $v eq {no}} {
315 + }
316 + set v [string tolower $v]
317 + if {$v eq {false} || $v eq {0} || $v eq {no} || $v eq {off}} {
318 return 1
319 } else {
320 return 0
@@ -1060,6 +1064,10 @@ git-version proc _parse_config {arr_name args} {
1064 } else {
1065 set arr($name) $value
1066 }
1067 + } elseif {[regexp {^([^\n]+)$} $line line name]} {
1068 + # no value given, but interpreting them as
1069 + # boolean will be handled as true
1070 + set arr($name) {}
1071 }
1072 }
1073 }
@@ -1075,6 +1083,10 @@ git-version proc _parse_config {arr_name args} {
1083 } else {
1084 set arr($name) $value
1085 }
1086 + } elseif {[regexp {^([^=]+)$} $line line name]} {
1087 + # no value given, but interpreting them as
1088 + # boolean will be handled as true
1089 + set arr($name) {}
1090 }
1091 }
1092 close $fd_rc