ImportCommitConfig(..),
buildImportCommit,
buildImportTrees,
+ canImportKeys,
importKeys,
filterImportableContents,
makeImportMatcher,
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.
-
-> 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
files into git, the same as is done when importing with content.
If the largefiles expression needs the file content available
(due to mimetype or mimeencoding being used), the import will fail.
+ * sync: When run without --content, import without copying from
+ importtree=yes directory special remotes.
+ (Other special remotes may support this later as well.)
-- Joey Hess <id@joeyh.name> Mon, 14 Sep 2020 18:34:37 -0400
import Annex.Export
import Annex.TaggedPush
import Annex.CurrentBranch
+import Annex.Import (canImportKeys)
import Types.FileMatcher
import qualified Database.Export as Export
import Utility.Bloom
let subdir = if S.null p
then Nothing
else Just (asTopFilePath p)
- Command.Import.seekRemote remote branch subdir importcontent
- void $ mergeRemote remote currbranch mergeconfig o
+ if canImportKeys remote importcontent
+ then do
+ Command.Import.seekRemote remote branch subdir importcontent
+ void $ mergeRemote remote currbranch mergeconfig o
+ else warning $ "Cannot import from " ++ Remote.name remote ++ " when not syncing content."
where
wantpull = remoteAnnexPull (Remote.gitconfig remote)