sync --no-content import from directory special remote
sync: When run without --content, import without copying from importtree=yes directory special remotes. (Other special remotes may support this later as well.) This commit was sponsored by Svenne Krap on Patreon.
This commit is contained in:
parent
3eaaec3113
commit
658ea7ca3c
3 changed files with 17 additions and 3 deletions
|
@ -12,6 +12,7 @@ module Annex.Import (
|
|||
ImportCommitConfig(..),
|
||||
buildImportCommit,
|
||||
buildImportTrees,
|
||||
canImportKeys,
|
||||
importKeys,
|
||||
filterImportableContents,
|
||||
makeImportMatcher,
|
||||
|
@ -281,6 +282,12 @@ buildImportTrees basetree msubdir importable = History
|
|||
topf = asTopFilePath $
|
||||
maybe lf (\sd -> getTopFilePath sd P.</> lf) msubdir
|
||||
|
||||
canImportKeys :: Remote -> Bool -> Bool
|
||||
canImportKeys remote importcontent =
|
||||
importcontent || isJust (Remote.importKey ia)
|
||||
where
|
||||
ia = Remote.importActions remote
|
||||
|
||||
{- Downloads all new ContentIdentifiers, or when importcontent is False,
|
||||
- generates Keys without downloading.
|
||||
-
|
||||
|
@ -304,7 +311,7 @@ importKeys
|
|||
-> ImportableContents (ContentIdentifier, ByteSize)
|
||||
-> Annex (Maybe (ImportableContents (Either Sha Key)))
|
||||
importKeys remote importtreeconfig importcontent importablecontents = do
|
||||
when (not importcontent && isNothing (Remote.importKey ia)) $
|
||||
unless (canImportKeys remote importcontent) $
|
||||
giveup "This remote does not support importing without downloading content."
|
||||
-- This map is used to remember content identifiers that
|
||||
-- were just imported, before they have necessarily been
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue