--only-annex --no-content combination

This commit is contained in:
Joey Hess 2020-02-18 12:29:31 -04:00
parent cc4521068c
commit 06f6eb7a70
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -221,7 +221,7 @@ seek' o = do
, [ mergeAnnex ] , [ mergeAnnex ]
] ]
whenM shouldsynccontent $ do whenM (shouldSyncContent o) $ do
mapM_ (withbranch . importRemote o mergeConfig) importremotes mapM_ (withbranch . importRemote o mergeConfig) importremotes
-- Send content to any exports before other -- Send content to any exports before other
@ -245,11 +245,6 @@ seek' o = do
void $ includeCommandAction $ withbranch $ pushLocal o void $ includeCommandAction $ withbranch $ pushLocal o
-- Pushes to remotes can run concurrently. -- Pushes to remotes can run concurrently.
mapM_ (commandAction . withbranch . pushRemote o) gitremotes mapM_ (commandAction . withbranch . pushRemote o) gitremotes
where
shouldsynccontent = pure (contentOption o)
<||> pure (not (null (contentOfOption o)))
<||> (pure (not (noContentOption o)) <&&> getGitConfigVal annexSyncContent)
<||> onlyAnnex o
{- Merging may delete the current directory, so go to the top {- Merging may delete the current directory, so go to the top
- of the repo. This also means that sync always acts on all files in the - of the repo. This also means that sync always acts on all files in the
@ -834,11 +829,18 @@ cleanupRemote remote (Just b, _) =
, Param $ Git.fromRef $ syncBranch $ , Param $ Git.fromRef $ syncBranch $
Git.Ref.base $ Annex.Branch.name Git.Ref.base $ Annex.Branch.name
] ]
shouldSyncContent :: SyncOptions -> Annex Bool
shouldSyncContent o
| noContentOption o = pure False
| contentOption o || not (null (contentOfOption o)) = pure True
| otherwise = getGitConfigVal annexSyncContent <||> onlyAnnex o
notOnlyAnnex :: SyncOptions -> Annex Bool notOnlyAnnex :: SyncOptions -> Annex Bool
notOnlyAnnex o = not <$> onlyAnnex o notOnlyAnnex o = not <$> onlyAnnex o
onlyAnnex :: SyncOptions -> Annex Bool onlyAnnex :: SyncOptions -> Annex Bool
onlyAnnex o = do onlyAnnex o
cfg <- getGitConfigVal annexSyncOnlyAnnex | notOnlyAnnexOption o = pure False
return $ not (notOnlyAnnexOption o) && (cfg || onlyAnnexOption o) | onlyAnnexOption o = pure True
| otherwise = getGitConfigVal annexSyncOnlyAnnex