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

@ -179,10 +179,11 @@ recordImportTree remote importtreeconfig importable = do
updatelocationlog oldexport finaltree = do
let stillpresent db k = liftIO $ not . null
<$> Export.getExportedLocation db k
let updater db oldkey _newkey _ = case oldkey of
Just (AnnexKey k) -> unlessM (stillpresent db k) $
logChange k (Remote.uuid remote) InfoMissing
Just (GitKey _) -> noop
let updater db moldkey _newkey _ = case moldkey of
Just oldkey -> case keyGitSha oldkey of
Nothing -> unlessM (stillpresent db oldkey) $
logChange oldkey (Remote.uuid remote) InfoMissing
Just _ -> noop
Nothing -> noop
db <- Export.openDb (Remote.uuid remote)
forM_ (exportedTreeishes oldexport) $ \oldtree ->