Skip to content

Preserve Windows drive letters in Git URLs - #2248

Merged
martindurant merged 1 commit into
fsspec:masterfrom
MokiMeow:fix-git-url-windows-drive
Oct 9, 2026
Merged

martindurant merged 1 commit into
fsspec:masterfrom
MokiMeow:fix-git-url-windows-drive

Conversation

@MokiMeow

@MokiMeow MokiMeow commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1125.

Split Git storage URLs at the final colon so Windows drive letters stay attached to the repository path. Cover explicit and default refs, POSIX, UNC and Windows paths, and real temporary repositories.

The original code fails ten cases; all 23 Git-backend tests pass after the fix. Related filesystem tests: 518 passed, 135 skipped, 12 expected failures. Changed-file checks and the documentation build pass.

path = super()._strip_protocol(path).lstrip("/")
if ":" in path:
path = path.split(":", 1)[1]
path = path.rsplit(":", 1)[1]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some people have switched to using [r]partition. If we don't expect more colon characters, it should be fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing URL grammar excludes : and @ from the file path, so the rightmost colon is the repository/file separator. Both parsing paths now use rsplit(":", 1), preserving the C: prefix while keeping that grammar. rpartition() would also work here; I kept the existing split structure. The regression cases cover URLs with and without refs, plus reads from a real temporary Git repository on Windows.

@martindurant
martindurant merged commit 2f58781 into fsspec:master Oct 9, 2026
11 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.

GitFileSystem on different drive in Windows

2 participants