Skip to content

feat: Allow config cache for microsoft/git 2.53.0.vfs.0.1+#1

Closed
derrickstolee wants to merge 1 commit intoconfig-listfrom
config-list-vfs
Closed

feat: Allow config cache for microsoft/git 2.53.0.vfs.0.1+#1
derrickstolee wants to merge 1 commit intoconfig-listfrom
config-list-vfs

Conversation

@derrickstolee
Copy link
Copy Markdown
Owner

This PR adds an optional VFS version check on top of the core config cache work in the config-list branch.

Context

The config-list branch gates the config cache on Git 2.54.0+, which is when upstream Git will ship the fix for git config list --type=<X> (gitgitgadget/git#2044). However, the microsoft/git fork may fast-track this fix into a 2.53.0.vfs.0.1 release.

What this adds

A single commit that extends SupportsConfigListType() to also recognize microsoft/git fork version strings (e.g., 2.53.0.vfs.0.1). The .vfs. marker in the version string distinguishes these builds from upstream, and the VFS suffix is parsed separately to check the minimum version.

Why a separate PR

This change is specific to the microsoft/git fork and is not needed for the core PR targeting the upstream git-credential-manager repo. Keeping it as a separate commit makes it easy to include or exclude depending on the target.

dscho added a commit to microsoft/git that referenced this pull request Mar 6, 2026
See gitgitgadget#2044 for the original review of this change.

The main feature here in Git is that `git config list --type=<X>` works
correctly.

But the real benefit is that we can update GCM to use `git config list
--type=<X>` to get the full list of config and store those values in the
cache without dozens of `git config --get` calls.

See git-ecosystem/git-credential-manager#2268 for the change that adds
this cache with a version check for Git 2.54.0. If we additionally add
derrickstolee/Git-Credential-Manager-Core#1, then a v2.53.0.vfs.0.1
release would also allow this behavior change.

I tested all of these features together against my copy of the Office
monorepo running a basic `git fetch`. Note that these runs are not
actually downloading much data, if any.

| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| Without Cache | 14.986 ± 0.255 | 14.558 | 15.192 | 3.29 ± 0.17 |
| With Cache | 4.561 ± 0.223 | 4.390 | 4.935 | 1.00 |

During this test, I used a single GCM version with these changes and
modified the environment variables to change the Git version executed by
GCM.

* [X] This is an early version of work already under review upstream.
(These exact commits are merged to `next`.)
Context:
The config cache version gate requires Git 2.54.0+ because that
is when upstream Git will include the fix for 'git config list
--type=<X>'. However, the microsoft/git fork may fast-track this
fix into a 2.53.0.vfs.0.1 release, allowing users of Git for
Windows (VFS-enabled builds) to benefit from the cache sooner.

Justification:
The microsoft/git fork uses version strings like
'2.53.0.vfs.0.1' where the '.vfs.' marker distinguishes it from
upstream Git. GitVersion parsing stops at the non-integer 'vfs'
component, so a simple numeric comparison would treat this as
2.53.0 and disable caching. We need an additional check that
recognizes VFS builds and compares their suffix version.

The base version (2.53.0) and VFS suffix (0.1) are checked
separately, allowing any future 2.53+ VFS build with the fix
to also benefit. Upstream 2.54.0+ continues to pass the existing
numeric check without hitting the VFS path.

Implementation:
Added SupportsConfigListType() helper that first checks the
upstream minimum (2.54.0), then looks for '.vfs.' in the original
version string. For VFS builds, it parses the base version and
VFS suffix independently and checks both against their respective
minimums (2.53.0 and 0.1).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mjcheetham added a commit to git-ecosystem/git-credential-manager that referenced this pull request Mar 18, 2026
In certain repos and on the Windows platform, `git-credential-manager`
can take 8-15 seconds before looking up a credential or having any
user-facing interaction. This is due to dozens of `git config --get`
processes that take 150-250 milliseconds each. The config keys that
cause this pain are `http.<url>.sslCAinfo` and `http.<url>.cookieFile`.
When `credential.useHttpPath` is enabled, each key is checked as `<url>`
is incrementally truncated by directory segment.

It would be best if we could call a single Git process to send multiple
config queries instead of running multiple processes.
gitgitgadget/git#2033 suggested this direction of a single process
solution, but it's very complicated! During review of that effort, it
was recommended to use `git config list` instead.

But then there's a different problem! In all released versions of Git,
`git config list` silently ignores the `--type` argument. We need the
`--type` argument to guarantee that the resulting output string matches
the `bool` or `path` formats.

The core Git change in gitgitgadget/git#2044 is now merged to `next` and
thus is queued for Git 2.54.0. (We should wait until it merges to
`master` before merging this change, just in case.) We can only check
compatibility using a version check since the original command silently
misbehaves.

This pull request allows for caching the list of all config values that
match the given types: bool, path, or none. These are loaded lazily so
if a command doesn't need one of the types then the command doesn't run.
We are also careful to clear this cache if GCM mutates the config.

Since we ask for Git config values using `--type=bool`, `--type=path`,
_and_ `--no-type`, we may launch three `git config list` commands to
satisfy these needs.

There is a possibility that this feature is fast-tracked into
microsoft/git, in which case the version check would need augmentation.
I have that available in derrickstolee#1 as
an example.

Disclaimer: I used Claude Code and GitHub Copilot CLI to assist with
this change. I carefully reviewed the changes and made adjustments based
on my own taste and testing.

I did an end-to-end performance test on a local monorepo and got these
results for improvements to no-op `git fetch` calls:

| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| Without Cache | 14.986 ± 0.255 | 14.558 | 15.192 | 3.29 ± 0.17 |
| With Cache | 4.561 ± 0.223 | 4.390 | 4.935 | 1.00 |
@derrickstolee
Copy link
Copy Markdown
Owner Author

Replaced by git-ecosystem#2296.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant