git-gui: remove git config --list handling for git < 1.5.3
git-gui uses `git config --null --list` to parse configuration. Git
versions prior to 1.5.3 do not have --null and need different treatment.
Nobody should be using such an old version anymore. (Moreover, since
0730a5a3a, git-gui requires git v2.36 or later). Keep only the code for
modern Git.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
maint
parent
f9a2e8a38f
commit
8255167b26
67
git-gui.sh
67
git-gui.sh
|
|
@ -1083,53 +1083,30 @@ unset -nocomplain idx fd
|
|||
##
|
||||
## config file parsing
|
||||
|
||||
git-version proc _parse_config {arr_name args} {
|
||||
>= 1.5.3 {
|
||||
upvar $arr_name arr
|
||||
array unset arr
|
||||
set buf {}
|
||||
catch {
|
||||
set fd_rc [eval \
|
||||
[list git_read config] \
|
||||
$args \
|
||||
[list --null --list]]
|
||||
fconfigure $fd_rc -translation binary -encoding utf-8
|
||||
set buf [read $fd_rc]
|
||||
close $fd_rc
|
||||
}
|
||||
foreach line [split $buf "\0"] {
|
||||
if {[regexp {^([^\n]+)\n(.*)$} $line line name value]} {
|
||||
if {[is_many_config $name]} {
|
||||
lappend arr($name) $value
|
||||
} else {
|
||||
set arr($name) $value
|
||||
}
|
||||
} elseif {[regexp {^([^\n]+)$} $line line name]} {
|
||||
# no value given, but interpreting them as
|
||||
# boolean will be handled as true
|
||||
set arr($name) {}
|
||||
}
|
||||
}
|
||||
proc _parse_config {arr_name args} {
|
||||
upvar $arr_name arr
|
||||
array unset arr
|
||||
set buf {}
|
||||
catch {
|
||||
set fd_rc [eval \
|
||||
[list git_read config] \
|
||||
$args \
|
||||
[list --null --list]]
|
||||
fconfigure $fd_rc -translation binary -encoding utf-8
|
||||
set buf [read $fd_rc]
|
||||
close $fd_rc
|
||||
}
|
||||
default {
|
||||
upvar $arr_name arr
|
||||
array unset arr
|
||||
catch {
|
||||
set fd_rc [eval [list git_read config --list] $args]
|
||||
while {[gets $fd_rc line] >= 0} {
|
||||
if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
|
||||
if {[is_many_config $name]} {
|
||||
lappend arr($name) $value
|
||||
} else {
|
||||
set arr($name) $value
|
||||
}
|
||||
} elseif {[regexp {^([^=]+)$} $line line name]} {
|
||||
# no value given, but interpreting them as
|
||||
# boolean will be handled as true
|
||||
set arr($name) {}
|
||||
}
|
||||
foreach line [split $buf "\0"] {
|
||||
if {[regexp {^([^\n]+)\n(.*)$} $line line name value]} {
|
||||
if {[is_many_config $name]} {
|
||||
lappend arr($name) $value
|
||||
} else {
|
||||
set arr($name) $value
|
||||
}
|
||||
close $fd_rc
|
||||
} elseif {[regexp {^([^\n]+)$} $line line name]} {
|
||||
# no value given, but interpreting them as
|
||||
# boolean will be handled as true
|
||||
set arr($name) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue