prevent git-annex log with read-only unmerged git-annex branches

It would display incomplete information, which would differ from the
information displayed with write access. So refuse to display anything.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2021-12-27 15:44:15 -04:00
parent 23a485498f
commit 058193adc6
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -1,6 +1,6 @@
{- git-annex command
-
- Copyright 2012, 2016 Joey Hess <id@joeyh.name>
- Copyright 2012-2021 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -82,15 +82,16 @@ optParser desc = LogOptions
mkpassthru n v = [Param ("--" ++ n), Param v]
seek :: LogOptions -> CommandSeek
seek o = do
seek o = ifM (null <$> Annex.Branch.getUnmergedRefs)
( do
m <- Remote.uuidDescriptions
zone <- liftIO getCurrentTimeZone
let outputter = mkOutputter m zone o
let seeker = AnnexedFileSeeker
{ startAction = start o outputter
, checkContentPresent = Nothing
-- the way this uses the location log would not be helped
-- by precaching the current value
-- the way this uses the location log would not be
-- helped by precaching the current value
, usesLocationLog = False
}
case (logFiles o, allOption o) of
@ -98,6 +99,8 @@ seek o = do
=<< workTreeItems ww fs
([], True) -> commandAction (startAll o outputter)
(_, True) -> giveup "Cannot specify both files and --all"
, giveup "This repository is read-only, and there are unmerged git-annex branches, which prevents displaying location log changes. (Set annex.merge-annex-branches to false to ignore the unmerged git-annex branches.)"
)
where
ww = WarnUnmatchLsFiles