Skip to content

Read gvfs.prefetch-use-idx from the merged git config - #2155

Merged
Tyrie Vella (tyrielv) merged 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/prefetch-use-idx-global
Nov 4, 2026
Merged

Tyrie Vella (tyrielv) merged 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/prefetch-use-idx-global

Conversation

@tyrielv

@tyrielv Tyrie Vella (tyrielv) commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem and Context

gvfs.prefetch-use-idx enables the pack-index object existence checker for blob prefetch. BlobPrefetcher read this setting with GitProcess.GetFromLocalConfig and parsed it with bool.TryParse. This causes two problems:

  • A value in the global or system git config has no effect. Only the repository's local config can enable the setting. Tools that roll out gvfs.* settings through the user's global git config cannot enable this feature.
  • Valid git boolean values, such as yes, on, and 1, are rejected. The setting then silently falls back to the default (false).

Other gvfs.* feature settings, such as gvfs.prefetch-offload, gvfs.trust-pack-indexes, gvfs.show-hydration-status, and gvfs.mount-progress, read the merged config chain through LibGit2Repo.GetConfigBoolOrDefault. Nothing in the pack-index checker depends on the config scope. The checker gets its object roots from the enlistment.

The default stays false, so behavior does not change for users who do not set the key.

Changes

  • Read gvfs.prefetch-use-idx with LibGit2Repo.GetConfigBoolOrDefault against the enlistment's working directory backing root. This is the same helper that PrefetchVerb uses for gvfs.prefetch-offload. The helper reads local, global, and system config, applies git boolean parsing, and returns the default with a warning if the value is invalid or the read fails.
  • Add functional tests to PrefetchVerbTests that set gvfs.prefetch-use-idx=yes only in a temporary global config and run gvfs prefetch --files. The tests point HOME (used by libgit2) and GIT_CONFIG_GLOBAL (used by git.exe) at the temporary config. The temporary config includes the original global config files. One test asserts that the prefetch log reports the pack-index object existence checker. The other test also sets the key to false in the local config and asserts that the local value takes precedence. The tests restore the local config and delete the temporary config when they complete.

Known gaps

libgit2 finds the global config through HOME/USERPROFILE and ignores GIT_CONFIG_GLOBAL. If GIT_CONFIG_GLOBAL points at another file, git.exe and GVFS can read different global values for this setting. This limit applies to every gvfs.* setting that GVFS reads through libgit2, and this change does not alter it.

BlobPrefetcher read gvfs.prefetch-use-idx with GitProcess.GetFromLocalConfig
and parsed the value with bool.TryParse. Two problems follow:

- A value in the global or system git config had no effect. Only the
  repository's local config enabled the pack-index object existence
  checker.
- Valid git boolean values such as "yes", "on", and "1" were rejected,
  and the setting silently fell back to the default.

Other gvfs.* feature settings (for example gvfs.prefetch-offload,
gvfs.trust-pack-indexes, and gvfs.show-hydration-status) read the merged
config chain through LibGit2Repo.GetConfigBoolOrDefault. Use the same
helper here. It applies git boolean parsing, and it returns the default
and logs a warning if the value is invalid or the read fails.

Add functional tests that set gvfs.prefetch-use-idx to "yes" only in a
temporary global config. One test confirms that prefetch uses the
pack-index object existence checker. The other test also sets the key to
"false" in the local config and confirms that the local value takes
precedence.

Assisted-by: Claude Opus 5.5
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@tyrielv
Tyrie Vella (tyrielv) force-pushed the tyrielv/prefetch-use-idx-global branch from e2bc68e to 7612b28 Compare November 4, 2026 22:11
@tyrielv
Tyrie Vella (tyrielv) marked this pull request as ready for review November 4, 2026 22:14
@KeithIsSleeping

Copy link
Copy Markdown

[KeithBot]: ✅ No issues found · iteration 1 (7612b28)

Validation

  • ✅ GVFS.UnitTests full suite, source+base
  • ✅ Prefetch + libgit2 config fixtures
  • ✅ Config matrix vs git oracle, 3 probes
  • ✅ GVFS.FunctionalTests compile
  • ✅ GVFS.CommandLine.Tests 94/94
  • ✅ CI run on head: 34/34 jobs green

Approving.

🤖 KeithBot · claude-opus-5.5, gpt-6.1-sol, gemini-4-argon · reply on a thread to dispute

@tyrielv
Tyrie Vella (tyrielv) merged commit a870983 into microsoft:master Nov 4, 2026
35 checks passed
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.

2 participants