use GIT keys for export of non-annexed files

This solves the problem that import of such files gets confused and
converts them back to annexed files.

The import code already used GIT keys internally when it determined a
file should not be annexed. So now when it sees a GIT key that export
used, it already does the right thing.

This also means that even older version of git-annex can import and will
do the right thing, once a fixed version has exported. Still, there may
be other complications around upgrades; still need to think it all
through.

Moved gitShaKey and keyGitSha from Key to Annex.Export since they're
only used for export/import.

Documented GIT keys in backends, since they do appear in the git-annex
branch now.

This commit was sponsored by Graham Spencer on Patreon.
This commit is contained in:
Joey Hess 2021-03-05 14:03:51 -04:00
parent deac6f12b5
commit fc61915230
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 80 additions and 88 deletions

View file

@ -200,9 +200,9 @@ removeExportTree h k loc = queueDb h $
-- and updates state.
type ExportDiffUpdater
= ExportHandle
-> Maybe ExportKey
-> Maybe Key
-- ^ old exported key
-> Maybe ExportKey
-> Maybe Key
-- ^ new exported key
-> Git.DiffTree.DiffTreeItem
-> Annex ()
@ -214,10 +214,10 @@ mkExportDiffUpdater
mkExportDiffUpdater removeold addnew h srcek dstek i = do
case srcek of
Nothing -> return ()
Just k -> liftIO $ removeold h (asKey k) loc
Just k -> liftIO $ removeold h k loc
case dstek of
Nothing -> return ()
Just k -> liftIO $ addnew h (asKey k) loc
Just k -> liftIO $ addnew h k loc
where
loc = mkExportLocation $ getTopFilePath $ Git.DiffTree.file i