handle overBranchFileContents with read-only unmerged git-annex branches

This makes --all error out in that situation. Which is better than
ignoring information from the branches.

To really handle the branches right, overBranchFileContents would need
to both query all the branches and union merge file contents
(or perhaps not provide any file content), as well as diffing between
branches to find files that are only present in the unmerged branches.
And also, it would need to handle transitions..

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2021-12-27 14:30:51 -04:00
parent d9d0fe5fa4
commit 7f6b2ca49c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 35 additions and 7 deletions

View file

@ -150,7 +150,9 @@ getCache opttemplate = ifM (Annex.getState Annex.force)
{- Scan all url logs and metadata logs in the branch and find urls
- and ItemIds that are already known. -}
knownItems :: Annex ([URLString], [ItemId])
knownItems = Annex.Branch.overBranchFileContents select (go [] [])
knownItems = Annex.Branch.overBranchFileContents select (go [] []) >>= \case
Just r -> return r
Nothing -> giveup "This repository is read-only."
where
select f
| isUrlLog f = Just ()