add thirdPartyPopulated interface
authorJoey Hess <joeyh@joeyh.name>
Fri, 18 Dec 2020 18:52:57 +0000 (14:52 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 18 Dec 2020 19:23:58 +0000 (15:23 -0400)
commit9a2c8757f37696ef4c56fdf155863846e235ab16
tree1687141bf2ce59e41cc468d58aa4ac6d16c87322
parent037f8b68635072daa48ea13a1cfd25875daf3f44
add thirdPartyPopulated interface

This is to support, eg a borg repo as a special remote, which is
populated not by running git-annex commands, but by using borg. Then
git-annex sync lists the content of the remote, learns which files are
annex objects, and treats those as present in the remote.

So, most of the import machinery is reused, to a new purpose. While
normally importtree maintains a remote tracking branch, this does not,
because the files stored in the remote are annex object files, not
user-visible filenames. But, internally, a git tree is still generated,
of the files on the remote that are annex objects. This tree is used
by retrieveExportWithContentIdentifier, etc. As with other import/export
remotes, that  the tree is recorded in the export log, and gets grafted
into the git-annex branch.

importKey changed to be able to return Nothing, to indicate when an
ImportLocation is not an annex object and so should be skipped from
being included in the tree.

It did not seem to make sense to have git-annex import do this, since
from the user's perspective, it's not like other imports. So only
git-annex sync does it.

Note that, git-annex sync does not yet download objects from such
remotes that are preferred content. importKeys is run with
content downloading disabled, to avoid getting the content of all
objects. Perhaps what's needed is for seekSyncContent to be run with these
remotes, but I don't know if it will just work (in particular, it needs
to avoid trying to transfer objects to them), so I skipped that for now.

(Untested and unused as of yet.)

This commit was sponsored by Jochen Bartl on Patreon.
23 files changed:
Annex/Import.hs
Command/Import.hs
Command/Sync.hs
Remote/Adb.hs
Remote/BitTorrent.hs
Remote/Bup.hs
Remote/Ddar.hs
Remote/Directory.hs
Remote/External.hs
Remote/GCrypt.hs
Remote/Git.hs
Remote/GitLFS.hs
Remote/Glacier.hs
Remote/Helper/ExportImport.hs
Remote/Hook.hs
Remote/HttpAlso.hs
Remote/P2P.hs
Remote/Rsync.hs
Remote/S3.hs
Remote/Tahoe.hs
Remote/Web.hs
Remote/WebDAV.hs
Types/Remote.hs