avoid git syncing with instantiate proxied remotes

These remotes have no url configured, so git pull and push will fail.
git-annex sync --content etc can still sync with them otherwise.

Also, avoid git syncing twice with the same url. This is for cases where
a proxied remote has been manually configured and so does have a url.
Or perhaps proxied remotes will get configured like that automatically
later.
This commit is contained in:
Joey Hess 2024-06-12 15:10:03 -04:00
parent a986a20034
commit 46a1fcb3ea
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 8 additions and 7 deletions

View file

@ -268,7 +268,8 @@ seek' o = startConcurrency transferStages $ do
remotes <- syncRemotes (syncWith o)
warnSyncContentTransition o remotes
-- Remotes that git can push to and pull from.
let gitremotes = filter Remote.gitSyncableRemote remotes
let gitremotes = nubBy sameGitRepo $
filter Remote.gitSyncableRemote remotes
-- Remotes that contain annex object content.
contentremotes <- filter (\r -> Remote.uuid r /= NoUUID)
<$> filterM (not <$$> liftIO . getDynamicConfig . remoteAnnexIgnore . Remote.gitconfig) remotes
@ -1158,3 +1159,7 @@ splitRemoteAnnexTrackingBranchSubdir tb = (branch, subdir)
subdir = if S.null p
then Nothing
else Just (asTopFilePath p)
sameGitRepo :: Remote -> Remote -> Bool
sameGitRepo x y =
remoteUrl (Remote.gitconfig x) == remoteUrl (Remote.gitconfig y)

View file

@ -451,7 +451,8 @@ claimingUrl' remotefilter url = do
- with an annex:: url configured? -}
gitSyncableRemote :: Remote -> Bool
gitSyncableRemote r
| gitSyncableRemoteType (remotetype r) = True
| gitSyncableRemoteType (remotetype r)
&& isJust (remoteUrl (gitconfig r)) = True
| otherwise = case remoteUrl (gitconfig r) of
Just u | "annex::" `isPrefixOf` u -> True
_ -> False

View file

@ -44,11 +44,6 @@ For June's work on [[design/passthrough_proxy]], implementation plan:
* Consider getting instantiated remotes into git remote list.
See design.
* Make commands like `git-annex sync` not git push/pull to proxied remotes.
That doesn't work because they have no url. Or, if proxied remotes are in
git remote list, it is unncessary work because it's the same url as the
proxy.
* Implement single upload with fanout to proxied remotes.
* Implement clusters.