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>

Johannes Sixt committed May 3, 2025 at 13:37 UTC 8255167b26003767b0ab50f498ffec33f80c2ef2
1 file changed +23 -46
git-gui.sh
+23 -46
@@ -1083,53 +1083,30 @@ unset -nocomplain idx fd
1083 ##
1084 ## config file parsing
1085
1086 -git-version proc _parse_config {arr_name args} {
1087 - >= 1.5.3 {
1088 - upvar $arr_name arr
1089 - array unset arr
1090 - set buf {}
1091 - catch {
1092 - set fd_rc [eval \
1093 - [list git_read config] \
1094 - $args \
1095 - [list --null --list]]
1096 - fconfigure $fd_rc -translation binary -encoding utf-8
1097 - set buf [read $fd_rc]
1098 - close $fd_rc
1099 - }
1100 - foreach line [split $buf "\0"] {
1101 - if {[regexp {^([^\n]+)\n(.*)$} $line line name value]} {
1102 - if {[is_many_config $name]} {
1103 - lappend arr($name) $value
1104 - } else {
1105 - set arr($name) $value
1106 - }
1107 - } elseif {[regexp {^([^\n]+)$} $line line name]} {
1108 - # no value given, but interpreting them as
1109 - # boolean will be handled as true
1110 - set arr($name) {}
1111 - }
1112 - }
1113 - }
1114 - default {
1115 - upvar $arr_name arr
1116 - array unset arr
1117 - catch {
1118 - set fd_rc [eval [list git_read config --list] $args]
1119 - while {[gets $fd_rc line] >= 0} {
1120 - if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
1121 - if {[is_many_config $name]} {
1122 - lappend arr($name) $value
1123 - } else {
1124 - set arr($name) $value
1125 - }
1126 - } elseif {[regexp {^([^=]+)$} $line line name]} {
1127 - # no value given, but interpreting them as
1128 - # boolean will be handled as true
1129 - set arr($name) {}
1130 - }
1086 +proc _parse_config {arr_name args} {
1087 + upvar $arr_name arr
1088 + array unset arr
1089 + set buf {}
1090 + catch {
1091 + set fd_rc [eval \
1092 + [list git_read config] \
1093 + $args \
1094 + [list --null --list]]
1095 + fconfigure $fd_rc -translation binary -encoding utf-8
1096 + set buf [read $fd_rc]
1097 + close $fd_rc
1098 + }
1099 + foreach line [split $buf "\0"] {
1100 + if {[regexp {^([^\n]+)\n(.*)$} $line line name value]} {
1101 + if {[is_many_config $name]} {
1102 + lappend arr($name) $value
1103 + } else {
1104 + set arr($name) $value
1105 }
1132 - close $fd_rc
1106 + } elseif {[regexp {^([^\n]+)$} $line line name]} {
1107 + # no value given, but interpreting them as
1108 + # boolean will be handled as true
1109 + set arr($name) {}
1110 }
1111 }
1112 }