Skip to content

Include executable extension in core.virtualfilesystem path#2038

Merged
tyrielv merged 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/virtualfs-config-extension
Jul 1, 2026
Merged

Include executable extension in core.virtualfilesystem path#2038
tyrielv merged 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/virtualfs-config-extension

Conversation

@tyrielv

@tyrielv tyrielv commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

core.virtualfilesystem is set to an absolute path without a file extension, even though VFSForGit is the one that writes the corresponding hook executable (with the platform-specific extension) to .git/hooks/.

Because git invokes core.virtualfilesystem via the shell (use_shell=1 in virtualfilesystem.c), on Windows this means cmd.exe has to probe PATHEXT candidates (.COM, .EXE, ...) to resolve the bare virtual-filesystem path to the actual virtual-filesystem.exe file on every hook invocation.

Since VFSForGit controls both the config value and the file it points to, this change appends GVFSPlatform.Instance.Constants.ExecutableExtension to the path — matching what HooksInstaller already does when writing the file — so the shell can exec the file directly without probing. This is a no-op on macOS/Linux, where ExecutableExtension is empty.

Testing

  • dotnet build src\GVFS\GVFS.UnitTests\GVFS.UnitTests.csproj -c Debug
  • Ran GVFS.UnitTests.exe: 876 passed, 0 failed (11 skipped tests are unrelated native-hook-exe checks that require a full native build).

git invokes core.virtualfilesystem via the shell (use_shell=1 in
virtualfilesystem.c), so on Windows the shell has to probe PATHEXT
candidates (.COM, .EXE, ...) to resolve the bare "virtual-filesystem"
path to the actual "virtual-filesystem.exe" file that HooksInstaller
writes to disk. Since VFSForGit controls both the config value and the
file it points to, append GVFSPlatform.Instance.Constants.ExecutableExtension
so the path matches the file exactly, avoiding repeated PATHEXT probing
on every hook invocation. This is a no-op on platforms where
ExecutableExtension is empty (macOS/Linux).

Assisted-by: Claude Sonnet 5
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@tyrielv tyrielv marked this pull request as ready for review July 1, 2026 18:35
@tyrielv tyrielv enabled auto-merge July 1, 2026 18:35
@tyrielv tyrielv merged commit b7827d1 into microsoft:master Jul 1, 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