Allow find --branch to be used in a bare repository, the same as the deprecated findref can be
This will allow later fully deprecating and removing findref. Sponsored-by: Erik Bjäreholt on Patreon
This commit is contained in:
parent
d8f94389e1
commit
570b1aa6a1
3 changed files with 9 additions and 2 deletions
|
@ -8,6 +8,8 @@ git-annex (10.20220725) UNRELEASED; urgency=medium
|
||||||
concurrency is enabled.
|
concurrency is enabled.
|
||||||
* stack.yaml: Updated to lts-19.16
|
* stack.yaml: Updated to lts-19.16
|
||||||
* Added new matching options --want-get-by and --want-drop-by.
|
* Added new matching options --want-get-by and --want-drop-by.
|
||||||
|
* Allow find --branch to be used in a bare repository, the same as
|
||||||
|
the deprecated findref can be.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 25 Jul 2022 15:35:45 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 25 Jul 2022 15:35:45 -0400
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,10 @@ repoExists :: CommandCheck
|
||||||
repoExists = CommandCheck 0 ensureInitialized
|
repoExists = CommandCheck 0 ensureInitialized
|
||||||
|
|
||||||
notBareRepo :: Command -> Command
|
notBareRepo :: Command -> Command
|
||||||
notBareRepo = addCheck $ whenM (fromRepo Git.repoIsLocalBare) $
|
notBareRepo = addCheck checkNotBareRepo
|
||||||
|
|
||||||
|
checkNotBareRepo :: Annex ()
|
||||||
|
checkNotBareRepo = whenM (fromRepo Git.repoIsLocalBare) $
|
||||||
giveup "You cannot run this command in a bare repository."
|
giveup "You cannot run this command in a bare repository."
|
||||||
|
|
||||||
noDaemonRunning :: Command -> Command
|
noDaemonRunning :: Command -> Command
|
||||||
|
|
|
@ -21,7 +21,7 @@ import qualified Utility.Format
|
||||||
import Utility.DataUnits
|
import Utility.DataUnits
|
||||||
|
|
||||||
cmd :: Command
|
cmd :: Command
|
||||||
cmd = notBareRepo $ withAnnexOptions [annexedMatchingOptions] $ mkCommand $
|
cmd = withAnnexOptions [annexedMatchingOptions] $ mkCommand $
|
||||||
command "find" SectionQuery "lists available files"
|
command "find" SectionQuery "lists available files"
|
||||||
paramPaths (seek <$$> optParser)
|
paramPaths (seek <$$> optParser)
|
||||||
|
|
||||||
|
@ -55,6 +55,8 @@ parseFormatOption =
|
||||||
|
|
||||||
seek :: FindOptions -> CommandSeek
|
seek :: FindOptions -> CommandSeek
|
||||||
seek o = do
|
seek o = do
|
||||||
|
unless (isJust (keyOptions o)) $
|
||||||
|
checkNotBareRepo
|
||||||
islimited <- limited
|
islimited <- limited
|
||||||
let seeker = AnnexedFileSeeker
|
let seeker = AnnexedFileSeeker
|
||||||
{ startAction = start o
|
{ startAction = start o
|
||||||
|
|
Loading…
Reference in a new issue