Skip to content

lfsapi: treat unknown scheme:// URLs as remote helpers - #6356

Open
somaz94 wants to merge 1 commit into
git-lfs:mainfrom
somaz94:fix/remote-helper-url-scheme
Open

somaz94 wants to merge 1 commit into
git-lfs:mainfrom
somaz94:fix/remote-helper-url-scheme

Conversation

@somaz94

@somaz94 somaz94 commented Oct 1, 2026

Copy link
Copy Markdown

Git invokes a remote helper for both the <transport>::<address> and the <transport>://<address> forms, but NewEndpoint only passed the double colon form through. A URL like remote://git-lfs/git-lfs.git fell into the bare SSH fallback and became https://remote///git-lfs/git-lfs.git with an SSH host of remote.

This passes an unknown scheme followed by :// through unchanged as well, which matches Git: transport_get() hands any is_url() URL that is not file, git or ssh to git-remote-<transport>. Scp-like host:path addresses still take the SSH path.

Validation: the new TestEndpointParsing case fails on main with the SSH misparse above and passes here. make test and the full shell suite (make -C t, 825 tests) pass locally. t-smudge.sh, which points origin at an unknown httpnope:// URL and expects the download to fail, still passes.

Fixes #6094

Assisted by Claude Code.

Git invokes a remote helper for a URL of the form
<transport>::<address>, and also for <transport>://<address> when Git
does not handle the transport itself.  In Git's transport_get(), any
URL which passes is_url() and is not a file, git, or ssh URL is handed
to the git-remote-<transport> program.

In commit f137f45 we started to pass URLs with an unknown scheme
through unchanged when they use the double colon form, and to treat
other unknown schemes as bare SSH URLs, because the URL parser reads
the host of a scp-like address such as "host:path" as a scheme.
However, a URL such as "remote://git-lfs/git-lfs.git" then becomes an
SSH endpoint for a host named "remote".

We now also pass through URLs whose unknown scheme is followed by
"://", as Git does, and add a test case for this form next to the
existing one for the double colon form.
@somaz94
somaz94 marked this pull request as ready for review October 1, 2026 08:06
@somaz94
somaz94 requested a review from a team as a code owner October 1, 2026 08:06
somaz94 added a commit to somaz94/somaz94 that referenced this pull request Oct 1, 2026

This branch has not been deployed

No deployments
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.

EndpointFinder does not detect <transport>://<address> format

1 participant