Fix Source Control view dropping files with long paths on Windows#310058
Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix Source Control view dropping files with long paths on Windows#310058yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Conversation
On Windows, git silently omits files whose absolute path exceeds MAX_PATH (260 characters) from commands such as `git status` and `git diff` unless the `core.longpaths` option is enabled. Because the git extension does not opt in, long-path files are missing from the Source Control view and from commit diffs even when running `git diff` in a terminal (with the option set globally) lists them. Inject `-c core.longpaths=true` into every git invocation on Windows so the extension's behavior does not depend on the user's global git configuration. The injection is a no-op on macOS and Linux, and it is skipped if the caller already passed an explicit `core.longpaths` override. Fixes microsoft#240770
2bf6364 to
3c938d0
Compare
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / Why
On Windows,
git statusandgit diffsilently omit files whose absolute path exceedsMAX_PATH(260 characters) unless thecore.longpathsconfig is enabled. Because the git extension does not opt in, those files are missing from the Source Control view and from commit comparison views, even though runninggit diffin a terminal (with the option enabled globally) lists them.This is a frequent pain point for Windows users with deeply-nested workspaces — see #240770.
Fixes #240770
Fix
Inject
-c core.longpaths=trueinto every git invocation made by the extension on Windows, via a small helper that runs insideGit.spawn:core.longpathsoverride (so per-command opt-outs still win).This keeps the extension's behavior consistent regardless of whether the user has
core.longpathsset in their global git config, and matches what users expect after seeing the file in their terminalgit statusoutput.Testing
git diffbehavior in the terminal.-c core.longpaths=....