From f98605bce7ecfa7fd155d501accb2734d3e9a422 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 12 Jun 2024 10:16:04 -0400 Subject: [PATCH] a local git remote cannot proxy Prevent listProxied from listing anything when the proxy remote's url is a local directory. Proxying does not work in that situation, because the proxied remotes have the same url, and so git-annex-shell is not run when accessing them, instead the proxy remote is accessed directly. I don't think there is any good way to support this. Even if the instantiated git repos for the proxied remotes somehow used an url that caused it to use git-annex-shell to access them, planned features like `git-annex copy --to proxy` accepting a key and sending it on to nodes behind the proxy would not work, since git-annex-shell is not used to access the proxy. So it would need to use something to access the proxy that causes git-annex-shell to be run and speaks P2P protocol over it. And we have that. It's a ssh connection to localhost. Of course, it would be possible to take ssh out of that mix, and swap in something that does not have encryption overhead and authentication complications, but otherwise behaves the same as ssh. And if the user wants to do that, GIT_SSH does exist. --- Remote/Git.hs | 5 ++++- doc/todo/git-annex_proxies.mdwn | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Remote/Git.hs b/Remote/Git.hs index 60382f1563..0d7356c26b 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -855,9 +855,12 @@ listProxied proxies rs = concat <$> mapM go rs Git.ConfigKey proxyconfigprefix = remoteConfig proxyname mempty -- Git remotes that are gcrypt or git-lfs special remotes cannot - -- proxy. Proxing is also not yet supported for remotes using P2P + -- proxy. Local git remotes cannot proxy either because + -- git-annex-shell is not used to access a local git url. + -- Proxing is also yet supported for remotes using P2P -- addresses. canproxy gc r | remoteAnnexGitLFS gc = False | Git.GCrypt.isEncrypted r = False + | Git.repoIsLocal r || Git.repoIsLocalUnknown r = False | otherwise = isNothing (repoP2PAddress r) diff --git a/doc/todo/git-annex_proxies.mdwn b/doc/todo/git-annex_proxies.mdwn index d6e5fcb80a..f03a784f9a 100644 --- a/doc/todo/git-annex_proxies.mdwn +++ b/doc/todo/git-annex_proxies.mdwn @@ -36,12 +36,6 @@ For June's work on [[design/passthrough_proxy]], implementation plan: 2. Remote instantiation for proxies. (done) -4. Prevent listProxied from listing anything when the proxy remote's - url is a local directory. Proxying does not work in that situation, - because the proxied remotes have the same url, and so git-annex-shell - is not run when accessing them, instead the proxy remote is accessed - directly. - 3. Implement git-annex-shell proxying for CONNECT and NOTIFYCHANGES. (For completeness, they will only be used when using tor-annex to access a proxy.) -- 2.39.5