move several readonly values to AnnexRead
This improves performance to a small extent in several places. Sponsored-by: Tobias Ammann on Patreon
This commit is contained in:
parent
4174ee33a4
commit
cb9cf30c48
42 changed files with 81 additions and 88 deletions
|
@ -45,12 +45,12 @@ import Annex.Concurrent
|
|||
-- although not always used.
|
||||
gitAnnexGlobalOptions :: [GlobalOption]
|
||||
gitAnnexGlobalOptions = commonGlobalOptions ++
|
||||
[ globalOption (setAnnexState . setnumcopies) $ option auto
|
||||
[ globalOption setnumcopies $ option auto
|
||||
( long "numcopies" <> short 'N' <> metavar paramNumber
|
||||
<> help "override desired number of copies"
|
||||
<> hidden
|
||||
)
|
||||
, globalOption (setAnnexState . setmincopies) $ option auto
|
||||
, globalOption setmincopies $ option auto
|
||||
( long "mincopies" <> short 'N' <> metavar paramNumber
|
||||
<> help "override minimum number of copies"
|
||||
<> hidden
|
||||
|
@ -100,8 +100,8 @@ gitAnnexGlobalOptions = commonGlobalOptions ++
|
|||
)
|
||||
]
|
||||
where
|
||||
setnumcopies n = Annex.changeState $ \s -> s { Annex.forcenumcopies = Just $ configuredNumCopies n }
|
||||
setmincopies n = Annex.changeState $ \s -> s { Annex.forcemincopies = Just $ configuredMinCopies n }
|
||||
setnumcopies n = setAnnexRead $ \rd -> rd { Annex.forcenumcopies = Just $ configuredNumCopies n }
|
||||
setmincopies n = setAnnexRead $ \rd -> rd { Annex.forcemincopies = Just $ configuredMinCopies n }
|
||||
setuseragent v = Annex.changeState $ \s -> s { Annex.useragent = Just v }
|
||||
setgitconfig v = Annex.addGitConfigOverride v
|
||||
setdesktopnotify v = Annex.changeState $ \s -> s { Annex.desktopnotify = Annex.desktopnotify s <> v }
|
||||
|
|
|
@ -25,12 +25,12 @@ import Annex.Debug
|
|||
-- Global options accepted by both git-annex and git-annex-shell sub-commands.
|
||||
commonGlobalOptions :: [GlobalOption]
|
||||
commonGlobalOptions =
|
||||
[ globalFlag (setAnnexState $ setforce True)
|
||||
[ globalFlag (setforce True)
|
||||
( long "force"
|
||||
<> help "allow actions that may lose annexed data"
|
||||
<> hidden
|
||||
)
|
||||
, globalFlag (setAnnexState $ setfast True)
|
||||
, globalFlag (setfast True)
|
||||
( long "fast" <> short 'F'
|
||||
<> help "avoid slow operations"
|
||||
<> hidden
|
||||
|
@ -67,12 +67,12 @@ commonGlobalOptions =
|
|||
)
|
||||
]
|
||||
where
|
||||
setforce v = Annex.changeState $ \s -> s { Annex.force = v }
|
||||
setforce v = setAnnexRead $ \rd -> rd { Annex.force = v }
|
||||
|
||||
setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
|
||||
setfast v = setAnnexRead $ \rd -> rd { Annex.fast = v }
|
||||
|
||||
setforcebackend v = setAnnexState $
|
||||
Annex.changeState $ \s -> s { Annex.forcebackend = Just v }
|
||||
setforcebackend v = setAnnexRead $
|
||||
\rd -> rd { Annex.forcebackend = Just v }
|
||||
|
||||
setdebug v = mconcat
|
||||
[ setAnnexRead $ \rd -> rd { Annex.debugenabled = v }
|
||||
|
|
|
@ -64,7 +64,7 @@ withFilesInGitAnnex ww a l = seekFilteredKeys a $
|
|||
seekHelper fst3 ww LsFiles.inRepoDetails l
|
||||
|
||||
withFilesInGitAnnexNonRecursive :: WarnUnmatchWhen -> String -> AnnexedFileSeeker -> WorkTreeItems -> CommandSeek
|
||||
withFilesInGitAnnexNonRecursive ww needforce a (WorkTreeItems l) = ifM (Annex.getState Annex.force)
|
||||
withFilesInGitAnnexNonRecursive ww needforce a (WorkTreeItems l) = ifM (Annex.getRead Annex.force)
|
||||
( withFilesInGitAnnex ww a (WorkTreeItems l)
|
||||
, if null l
|
||||
then giveup needforce
|
||||
|
@ -90,7 +90,7 @@ withFilesInGitAnnexNonRecursive _ _ _ NoWorkTreeItems = noop
|
|||
|
||||
withFilesNotInGit :: CheckGitIgnore -> WarnUnmatchWhen -> ((SeekInput, RawFilePath) -> CommandSeek) -> WorkTreeItems -> CommandSeek
|
||||
withFilesNotInGit (CheckGitIgnore ci) ww a l = do
|
||||
force <- Annex.getState Annex.force
|
||||
force <- Annex.getRead Annex.force
|
||||
let include_ignored = force || not ci
|
||||
seekFiltered (const (pure True)) a $
|
||||
seekHelper id ww (const $ LsFiles.notInRepo [] include_ignored) l
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue