convert all applicable commands to new 2x faster annexed file seeking

This removes all calls to inAnnex, except for some involving --batch.
It may be that the batch code could get a similar speedup, but I don't
know if people habitually pass a huge number of files through --batch
that git-annex does not need to do anything to process, so I skipped it
for now.

A few calls to ifAnnexed remain, and might be worth doing more to
convert. In particular, Command.Sync has one that would probably speed
it up by a good amount.

(also removed some dead code from Command.Lock)
This commit is contained in:
Joey Hess 2020-07-10 15:40:06 -04:00
parent b4d0f6dfc2
commit 88a7fb5cbb
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
19 changed files with 54 additions and 60 deletions

View file

@ -53,18 +53,18 @@ withFilesInGitAnnex :: WarnUnmatchWhen -> (RawFilePath -> Key -> CommandSeek) ->
withFilesInGitAnnex ww a l = seekFilteredKeys a $
seekHelper fst3 ww LsFiles.inRepoDetails l
withFilesInGitNonRecursive :: WarnUnmatchWhen -> String -> (RawFilePath -> CommandSeek) -> [WorkTreeItem] -> CommandSeek
withFilesInGitNonRecursive ww needforce a l = ifM (Annex.getState Annex.force)
( withFilesInGit ww a l
withFilesInGitAnnexNonRecursive :: WarnUnmatchWhen -> String -> (RawFilePath -> Key -> CommandSeek) -> [WorkTreeItem] -> CommandSeek
withFilesInGitAnnexNonRecursive ww needforce a l = ifM (Annex.getState Annex.force)
( withFilesInGitAnnex ww a l
, if null l
then giveup needforce
else seekFiltered a (getfiles [] l)
else seekFilteredKeys a (getfiles [] l)
)
where
getfiles c [] = return (reverse c)
getfiles c ((WorkTreeItem p):ps) = do
os <- seekOptions ww
(fs, cleanup) <- inRepo $ LsFiles.inRepo os [toRawFilePath p]
(fs, cleanup) <- inRepo $ LsFiles.inRepoDetails os [toRawFilePath p]
case fs of
[f] -> do
void $ liftIO $ cleanup