sync with special remotes with an annex:: url
Check explicitly for an annex:: url, not just any url. While no built-in special remotes set an url, except ones that can be synced with, it seems possible that some external special remote sets an url for its own use, but did not expect it to be used by git-annex sync et al. The assistant also syncs with them.
This commit is contained in:
parent
22bf23782f
commit
58301e40d2
6 changed files with 26 additions and 7 deletions
|
@ -64,7 +64,7 @@ calcSyncRemotes = do
|
|||
|
||||
return $ \dstatus -> dstatus
|
||||
{ syncRemotes = syncable
|
||||
, syncGitRemotes = filter (Remote.gitSyncableRemoteType . Remote.remotetype) syncable
|
||||
, syncGitRemotes = filter Remote.gitSyncableRemote syncable
|
||||
, syncDataRemotes = dataremotes
|
||||
, exportRemotes = exportremotes
|
||||
, downloadRemotes = contentremotes
|
||||
|
|
|
@ -267,8 +267,8 @@ seek' o = startConcurrency transferStages $ do
|
|||
|
||||
remotes <- syncRemotes (syncWith o)
|
||||
warnSyncContentTransition o remotes
|
||||
-- Remotes that are git repositories, not (necessarily) special remotes.
|
||||
let gitremotes = filter (Remote.gitSyncableRemoteType . Remote.remotetype) remotes
|
||||
-- Remotes that git can push to and pull from.
|
||||
let gitremotes = 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
|
||||
|
|
12
Remote.hs
12
Remote.hs
|
@ -26,7 +26,6 @@ module Remote (
|
|||
remoteTypes,
|
||||
remoteList,
|
||||
remoteList',
|
||||
gitSyncableRemoteType,
|
||||
remoteMap,
|
||||
remoteMap',
|
||||
uuidDescriptions,
|
||||
|
@ -61,6 +60,8 @@ module Remote (
|
|||
claimingUrl,
|
||||
claimingUrl',
|
||||
isExportSupported,
|
||||
gitSyncableRemote,
|
||||
gitSyncableRemoteType,
|
||||
) where
|
||||
|
||||
import Data.Ord
|
||||
|
@ -445,3 +446,12 @@ claimingUrl' remotefilter url = do
|
|||
fromMaybe web <$> firstM checkclaim (filter remotefilter rs)
|
||||
where
|
||||
checkclaim = maybe (pure False) (`id` url) . claimUrl
|
||||
|
||||
{- Is this a remote of a type we can sync with, or a special remote
|
||||
- with an annex:: url configured? -}
|
||||
gitSyncableRemote :: Remote -> Bool
|
||||
gitSyncableRemote r
|
||||
| gitSyncableRemoteType (remotetype r) = True
|
||||
| otherwise = case remoteUrl (gitconfig r) of
|
||||
Just u | "annex::" `isPrefixOf` u -> True
|
||||
_ -> False
|
||||
|
|
|
@ -109,7 +109,11 @@ updateRemote remote = do
|
|||
Remote.Git.configRead False r
|
||||
| otherwise = return r
|
||||
|
||||
{- Checks if a remote is syncable using git. -}
|
||||
{- Types of remotes that are always syncable using git.
|
||||
-
|
||||
- This does not include special remotes that may or may not have an
|
||||
- annex:: url that allows using git-remote-annex with them.
|
||||
-}
|
||||
gitSyncableRemoteType :: RemoteType -> Bool
|
||||
gitSyncableRemoteType t = t `elem`
|
||||
[ Remote.Git.remote
|
||||
|
|
|
@ -374,6 +374,7 @@ data RemoteGitConfig = RemoteGitConfig
|
|||
, remoteAnnexAllowUnverifiedDownloads :: Bool
|
||||
, remoteAnnexConfigUUID :: Maybe UUID
|
||||
, remoteAnnexAllowEncryptedGitRepo :: Bool
|
||||
, remoteUrl :: Maybe String
|
||||
|
||||
{- These settings are specific to particular types of remotes
|
||||
- including special remotes. -}
|
||||
|
@ -480,6 +481,12 @@ extractRemoteGitConfig r remotename = do
|
|||
, remoteAnnexExternalType = notempty $ getmaybe "externaltype"
|
||||
, remoteAnnexAllowEncryptedGitRepo =
|
||||
getbool "allow-encrypted-gitrepo" False
|
||||
, remoteUrl =
|
||||
case Git.Config.getMaybe (remoteConfig remotename "url") r of
|
||||
Just (ConfigValue b)
|
||||
| B.null b -> Nothing
|
||||
| otherwise -> Just (decodeBS b)
|
||||
_ -> Nothing
|
||||
}
|
||||
where
|
||||
getbool k d = fromMaybe d $ getmaybebool k
|
||||
|
|
|
@ -10,8 +10,6 @@ will be available to users who don't use datalad.
|
|||
|
||||
This is implememented and working. Remaining todo list for it:
|
||||
|
||||
* git-annex sync doesn't pull/push to these remotes, and should.
|
||||
|
||||
* Cloning from an annex:: url with importtree=yes doesn't work
|
||||
(with or without exporttree=yes). This is because the ContentIdentifier
|
||||
db is not populated. It should be possible to work around this.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue