Commit 0fea6fa
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 c7687ad commit 0fea6fa
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 | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| 346 | + | |
346 | 347 | | |
347 | 348 | | |
348 | 349 | | |
| |||
360 | 361 | | |
361 | 362 | | |
362 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
363 | 372 | | |
364 | 373 | | |
365 | 374 | | |
| |||
0 commit comments