improve handling of unmerged git-annex branches in readonly repo
git-annex info was displaying a message that didn't make sense in
context.
In calcRepoSizes, it seems better to return the information from the
git-annex branch, rather than giving up. Especially since balanced
preferred content uses it, and we can't just give up evaluating a
preferred content expression if git-annex is to be usable in such a
readonly repo.
Commit 6d7ecd9e5d
nobly wanted git-annex
to behave the same with such unmerged branches as it does when it can
merge them. But for the purposes of preferred content, it seems to me
there's a sense that such an unmerged branch is the same as a remote we
have not pulled from. The balanced preferred content will either way
operate under outdated information, and so make not the best choices.
This commit is contained in:
parent
5c35b3d579
commit
467d80101a
7 changed files with 46 additions and 27 deletions
|
@ -33,6 +33,7 @@ import Annex.WorkTree
|
|||
import Logs.UUID
|
||||
import Logs.Trust
|
||||
import Logs.Location
|
||||
import Annex.Branch (UnmergedBranches(..))
|
||||
import Annex.NumCopies
|
||||
import Git.Config (boolConfig)
|
||||
import qualified Git.LsTree as LsTree
|
||||
|
@ -640,7 +641,7 @@ cachedAllRepoData = do
|
|||
Just _ -> return s
|
||||
Nothing -> do
|
||||
matcher <- lift getKeyOnlyMatcher
|
||||
!(d, rd) <- lift $ overLocationLogs (emptyKeyInfo, mempty) $ \k locs (d, rd) -> do
|
||||
r <- lift $ overLocationLogs (emptyKeyInfo, mempty) $ \k locs (d, rd) -> do
|
||||
ifM (matchOnKey matcher k)
|
||||
( do
|
||||
alivelocs <- snd
|
||||
|
@ -650,9 +651,14 @@ cachedAllRepoData = do
|
|||
return (d', rd')
|
||||
, return (d, rd)
|
||||
)
|
||||
let s' = s { allRepoData = Just d, repoData = rd }
|
||||
put s'
|
||||
return s'
|
||||
case r of
|
||||
NoUnmergedBranches (!(d, rd)) -> do
|
||||
let s' = s { allRepoData = Just d, repoData = rd }
|
||||
put s'
|
||||
return s'
|
||||
UnmergedBranches _ -> do
|
||||
lift $ warning "This repository is read-only, and there are unmerged git-annex branches. Information from those branches is not included here."
|
||||
return s
|
||||
where
|
||||
accumrepodata k = M.alter (Just . addKey k . fromMaybe emptyKeyInfo)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue