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 {- 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. - Licensed under the GNU AGPL version 3 or higher.
-} -}
@ -82,22 +82,25 @@ optParser desc = LogOptions
mkpassthru n v = [Param ("--" ++ n), Param v] mkpassthru n v = [Param ("--" ++ n), Param v]
seek :: LogOptions -> CommandSeek seek :: LogOptions -> CommandSeek
seek o = do seek o = ifM (null <$> Annex.Branch.getUnmergedRefs)
m <- Remote.uuidDescriptions ( do
zone <- liftIO getCurrentTimeZone m <- Remote.uuidDescriptions
let outputter = mkOutputter m zone o zone <- liftIO getCurrentTimeZone
let seeker = AnnexedFileSeeker let outputter = mkOutputter m zone o
{ startAction = start o outputter let seeker = AnnexedFileSeeker
, checkContentPresent = Nothing { startAction = start o outputter
-- the way this uses the location log would not be helped , checkContentPresent = Nothing
-- by precaching the current value -- the way this uses the location log would not be
, usesLocationLog = False -- helped by precaching the current value
} , usesLocationLog = False
case (logFiles o, allOption o) of }
(fs, False) -> withFilesInGitAnnex ww seeker case (logFiles o, allOption o) of
=<< workTreeItems ww fs (fs, False) -> withFilesInGitAnnex ww seeker
([], True) -> commandAction (startAll o outputter) =<< workTreeItems ww fs
(_, True) -> giveup "Cannot specify both files and --all" ([], 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 where
ww = WarnUnmatchLsFiles ww = WarnUnmatchLsFiles