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
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue