Commit 94a591d
fix: match Git config names case-insensitively (#2240)
GitConfigParser required exact section and option spelling, so valid Git
configuration such as core.BigName could not be read as CORE.bigname.
Differently cased sections and options also stayed separate, causing
lookups to miss later values and writers to create duplicate settings.
Index the ordered multi-dictionary by normalized names while retaining
the first spelling in storage. Lowercase the section/option portion only;
quoted subsection names remain case-sensitive. The shared mapping covers
the inherited ConfigParser accessors, multivalue reads, and mutations
without scanning all stored names. Case variants now merge in read order,
and enumeration and write-back use the first spelling for each name.
Normalize include section matching and remote discovery as well, while
keeping include conditions and remote names case-sensitive.
Add regressions for case variants, duplicate values, implicit booleans,
quoted subsections, spelling-preserving writes, removal and renaming,
included files, and remote discovery. The three new regression tests
failed before the fix. Extend the existing setlast check to cover mixed
case and clearing the name index.
The behavior follows Documentation/config.adoc and the mixed-case and
subsection tests in t/t1300-config.sh from the local Git reference at
1630431f326e15fcde608827b5ff38422528eb59. Regression comparisons with
git config --get and --get-all used Git 2.50.1 (Apple Git-155).
Validation:
- Python 3.9.6: config suite plus remote creation/removal and multiple URL
tests, 47 passed and 2 existing skips.
- Python 3.14.7: config suite, 45 passed and 2 existing skips.
- Ruff 0.16.5 check and format --check passed for the repository.
- mypy 1.18.2 passed for 46 source files; basedpyright 1.39.9 reported
zero errors and warnings with the test environment's interpreter.
- A scaling check parsed 1,000 and 10,000 remote sections in approximately
0.008 and 0.080 seconds, respectively.1 parent 696e1cb commit 94a591d
3 files changed
Lines changed: 146 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
206 | 212 | | |
207 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
208 | 229 | | |
209 | 230 | | |
210 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
211 | 236 | | |
212 | 237 | | |
213 | 238 | | |
214 | | - | |
| 239 | + | |
215 | 240 | | |
216 | 241 | | |
217 | | - | |
| 242 | + | |
218 | 243 | | |
219 | 244 | | |
| 245 | + | |
220 | 246 | | |
| 247 | + | |
221 | 248 | | |
222 | 249 | | |
223 | | - | |
| 250 | + | |
224 | 251 | | |
225 | 252 | | |
226 | | - | |
| 253 | + | |
227 | 254 | | |
228 | 255 | | |
229 | 256 | | |
230 | | - | |
| 257 | + | |
231 | 258 | | |
232 | 259 | | |
233 | | - | |
234 | | - | |
| 260 | + | |
235 | 261 | | |
236 | 262 | | |
237 | | - | |
| 263 | + | |
238 | 264 | | |
239 | 265 | | |
240 | | - | |
| 266 | + | |
241 | 267 | | |
242 | 268 | | |
243 | 269 | | |
| |||
286 | 312 | | |
287 | 313 | | |
288 | 314 | | |
289 | | - | |
290 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
291 | 318 | | |
292 | 319 | | |
293 | 320 | | |
| |||
641 | 668 | | |
642 | 669 | | |
643 | 670 | | |
644 | | - | |
| 671 | + | |
| 672 | + | |
645 | 673 | | |
646 | 674 | | |
647 | | - | |
| 675 | + | |
648 | 676 | | |
649 | 677 | | |
650 | 678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
635 | | - | |
| 635 | + | |
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
106 | 202 | | |
107 | 203 | | |
108 | 204 | | |
| |||
1119 | 1215 | | |
1120 | 1216 | | |
1121 | 1217 | | |
1122 | | - | |
| 1218 | + | |
1123 | 1219 | | |
1124 | 1220 | | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
0 commit comments