Commit 3125246
feat: Gate config cache on Git 2.54.0+ version check
Context:
The config cache uses 'git config list --type=<X>' to load
type-specific caches (raw, bool, path). The --type flag for the
'list' subcommand requires a fix queued for the Git 2.54.0
release. On Git 2.53 and earlier, the command succeeds but
silently ignores the --type parameter, returning raw values
instead of canonicalized ones. This means bool caches would
contain 'yes'/'on' instead of 'true', and path caches would
contain unexpanded '~/...' instead of absolute paths.
Justification:
Because the command exits 0 on older Git, the cache appears to
load successfully and the fallback paths never trigger. This makes
the bug silent and data-dependent: lookups work for values that
happen to already be in canonical form but return wrong results
for others. A version gate is the only reliable way to avoid this.
The check is in the constructor body rather than the constructor
chain so we can log a trace message when caching is disabled. The
explicit useCache parameter is preserved for tests that need to
control caching behavior independently of version.
Implementation:
Added ConfigListTypeMinVersion constant (2.54.0) and a version
comparison in the GitProcessConfiguration constructor. When
useCache is requested but git.Version is below the minimum, the
constructor overrides useCache to false and emits a trace line.
All existing fallback paths continue to work unchanged for users
on older Git, who will benefit from the cache automatically once
they upgrade.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 4f37e54 commit 3125246
File tree
1 file changed
+9
-0
lines changed1 file changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
337 | 338 | | |
338 | 339 | | |
339 | 340 | | |
| |||
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
354 | 363 | | |
355 | 364 | | |
356 | 365 | | |
| |||
0 commit comments