lookupkey: Sped up --batch
When the file is relative, it does not need to be passed through git lsfiles to normalize it. Sponsored-by: Kevin Mueller on Patreon
This commit is contained in:
parent
8a540138b6
commit
f8d35d9480
4 changed files with 27 additions and 8 deletions
|
@ -9,6 +9,7 @@ git-annex (10.20230927) UNRELEASED; urgency=medium
|
|||
the behavior of git on Windows, which does not end lines with CR
|
||||
either.
|
||||
* Windows: Fix CRLF handling in some log files.
|
||||
* lookupkey: Sped up --batch.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Tue, 10 Oct 2023 13:17:31 -0400
|
||||
|
||||
|
|
|
@ -50,11 +50,13 @@ display Nothing = return False
|
|||
-- To support absolute filenames, pass through git ls-files.
|
||||
-- But, this plumbing command does not recurse through directories.
|
||||
seekSingleGitFile :: FilePath -> Annex (Maybe RawFilePath)
|
||||
seekSingleGitFile file = do
|
||||
(l, cleanup) <- inRepo (Git.LsFiles.inRepo [] [toRawFilePath file])
|
||||
r <- case l of
|
||||
(f:[]) | takeFileName (fromRawFilePath f) == takeFileName file ->
|
||||
return (Just f)
|
||||
_ -> return Nothing
|
||||
void $ liftIO cleanup
|
||||
return r
|
||||
seekSingleGitFile file
|
||||
| isRelative file = return (Just (toRawFilePath file))
|
||||
| otherwise = do
|
||||
(l, cleanup) <- inRepo (Git.LsFiles.inRepo [] [toRawFilePath file])
|
||||
r <- case l of
|
||||
(f:[]) | takeFileName (fromRawFilePath f) == takeFileName file ->
|
||||
return (Just f)
|
||||
_ -> return Nothing
|
||||
void $ liftIO cleanup
|
||||
return r
|
||||
|
|
|
@ -21,3 +21,5 @@ This surprised me, hence I am reporting it here as a potential bug.
|
|||
### What version of git-annex are you using? On what operating system?
|
||||
|
||||
git-annex version: 10.20230126
|
||||
|
||||
> [[fixed|done]] --[[Joey]]
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 1"""
|
||||
date="2023-10-30T18:51:11Z"
|
||||
content="""
|
||||
This is due to lookupkey passing each filename through `git ls-files`
|
||||
in order to support absolute filepaths input. See
|
||||
[[!commit cfdfe4df6c8b3fe46bbc7afcc8274237a5b2ce2a]]
|
||||
|
||||
Made it only do that for absolute paths, which should make it at least
|
||||
marginally faster than git-annex find. I would not expect it to be much
|
||||
faster though, because git-annex find displaying a little more information
|
||||
takes negligible CPU time really.
|
||||
"""]]
|
Loading…
Reference in a new issue