add Backend.GitRemoteAnnex

Making GITBUNDLE be in the backend list allows those keys to be
hashed to verify, both when git-remote-annex downloads them, and by other
transfers and by git fsck.

GITMANIFEST is not in the backend list, because those keys will never be
stored in .git/annex/objects and can't be verified in any case.

This does mean that git-annex version will include GITBUNDLE in the list
of backends.

Also documented these in backends.mdwn

Sponsored-by: Kevin Mueller on Patreon
This commit is contained in:
Joey Hess 2024-05-07 13:42:12 -04:00
parent 483887591d
commit c7731cdbd9
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 110 additions and 14 deletions

View file

@ -219,6 +219,7 @@ data KeyVariety
| WORMKey
| URLKey
| VURLKey
| GitBundleKey
-- A key that is handled by some external backend.
| ExternalKey S.ByteString HasExt
-- Some repositories may contain keys of other varieties,
@ -253,6 +254,7 @@ hasExt (MD5Key (HasExt b)) = b
hasExt WORMKey = False
hasExt URLKey = False
hasExt VURLKey = False
hasExt GitBundleKey = False
hasExt (ExternalKey _ (HasExt b)) = b
hasExt (OtherKey s) = (snd <$> S8.unsnoc s) == Just 'E'
@ -282,6 +284,7 @@ formatKeyVariety v = case v of
WORMKey -> "WORM"
URLKey -> "URL"
VURLKey -> "VURL"
GitBundleKey -> "GITBUNDLE"
ExternalKey s e -> adde e ("X" <> s)
OtherKey s -> s
where
@ -347,6 +350,7 @@ parseKeyVariety "MD5E" = MD5Key (HasExt True)
parseKeyVariety "WORM" = WORMKey
parseKeyVariety "URL" = URLKey
parseKeyVariety "VURL" = VURLKey
parseKeyVariety "GITBUNDLE" = GitBundleKey
parseKeyVariety b
| "X" `S.isPrefixOf` b =
let b' = S.tail b