Skip to content

Honor lfs.url when deciding on transfer adapters#3905

Merged
bk2204 merged 1 commit intogit-lfs:masterfrom
bk2204:lfs-url-standalone
Nov 13, 2019
Merged

Honor lfs.url when deciding on transfer adapters#3905
bk2204 merged 1 commit intogit-lfs:masterfrom
bk2204:lfs-url-standalone

Conversation

@bk2204
Copy link
Member

@bk2204 bk2204 commented Nov 6, 2019

Currently, if you have a remote with a file URL but have lfs.url set to point to a non-file URL, your transfers will fail. This occurs because we look up whether to use a transfer adapter based on the remote URL, but we also look up whether to default to the built-in transfer adapter based on the remote URL, not the endpoint URL. We then attempt to pass the HTTP URL to the standalone transfer adapter, which doesn't work.

Look up the endpoint URL as well and pass that to the code which determines whether we should use the builtin transfer adapter. If the actual endpoint is not a file URL, then we won't suggest the builtin transfer adapter.

As a note to the harried reviewer, the Endpoint function looks up all LFS endpoints and is more complete than the RemoteEndpoint function, which only looks up the endpoint based on the remote. We want to look up options in the config based on the remote (to work more like Git), but synthesize our own based only on the actual endpoint.

Fixes #3893.
/cc @ulilaube as reporter

Currently, if you have a remote with a file URL but have lfs.url set to
point to a non-file URL, your transfers will fail.  This occurs because
we look up whether to use a transfer adapter based on the remote URL,
but we also look up whether to default to the built-in transfer adapter
based on the remote URL, not the endpoint URL.  We then attempt to pass
the HTTP URL to the standalone transfer adapter, which doesn't work.

Look up the endpoint URL as well and pass that to the code which
determines whether we should use the builtin transfer adapter.  If the
actual endpoint is not a file URL, then we won't suggest the builtin
transfer adapter.
@bk2204 bk2204 requested a review from a team November 6, 2019 22:36
@bk2204 bk2204 added this to the v2.9.1 milestone Nov 6, 2019
Copy link
Member

@chrisd8088 chrisd8088 left a comment

Choose a reason for hiding this comment

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

This seems all good, as far as I can tell -- thank you for the substantive and contrasting tests; they were very helpful in understanding the intent of the patch!

@bk2204 bk2204 merged commit bade618 into git-lfs:master Nov 13, 2019
@bk2204 bk2204 deleted the lfs-url-standalone branch November 13, 2019 15:56
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Oct 17, 2023
The findStandaloneTransfer() function of the "tq" package was updated
in commit 28f9b73 of PR git-lfs#3905 to
determine whether to use the built-in file standalone transfer adapter
based on the actual endpoint URL, taking into account settings like
"lfs.url" which override the endpoint URL we would otherwise construct
from the current remote's URL.  However, the code still checked the
"lfs.<url>.standaloneTransferAgent" setting using the URL constructed
from the remote's URL, and so called both the Endpoint() and
RemoteEndpoint() methods of the EndpointFinder interface.

Then in commit 594f8e3 of PR git-lfs#4446,
when the pure SSH transfer protocol was introduced, the call to
the RemoteEndpoint() method was replaced with Endpoint(), which was
done with the intent that it would honour "lfs.url" settings as well.

However, this resulted in duplicate calls to Endpoint(), so we can
remove one of them now.

Note that the change in commit 594f8e3
of PR git-lfs#4446 implies that the URL used when looking for
"lfs.<url>.standaloneTransferAgent" settings is the URL as fully
determined by settings such as "lfs.url" that override what
would be otherwise constructed based on the remote's URL.  We
expect to add documentation to this effect in a subsequent PR.
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.

lfs.url not honored when using local path as remote

2 participants