]> dgit.raspbian.org Git - git-annex.git/commitdiff
avoid git syncing with instantiate proxied remotes
authorJoey Hess <joeyh@joeyh.name>
Wed, 12 Jun 2024 19:10:03 +0000 (15:10 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 12 Jun 2024 19:10:03 +0000 (15:10 -0400)
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.

Command/Sync.hs
Remote.hs
doc/todo/git-annex_proxies.mdwn

index 62b557ccc7126372e81d3dd37b02a2b5a29f9304..ff76307ab5ee5a3b889f6b56ca09dd8b60571b0b 100644 (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)
index 501f010b2e21794dbbeb2ad4ea29c4f97da6d9df..7297c5353a78143cfe99cb0301a7f4fbc832c448 100644 (file)
--- a/Remote.hs
+++ b/Remote.hs
@@ -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
index 6faa9876a01f8311b6464bc1b098a0d7ac49280c..b63fc865aea5ab3bfa39cb4c6357e1101e0972d6 100644 (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.