avoid double RawFilePath conversion

Minor optimisation.
This commit is contained in:
Joey Hess 2023-10-26 13:41:17 -04:00
parent d9fd205cbb
commit b0302c937d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -164,9 +164,8 @@ batchFilesKeys fmt a = do
matcher <- getMatcher matcher <- getMatcher
go $ \si v -> case v of go $ \si v -> case v of
Right f -> Right f ->
let f' = toRawFilePath f ifM (matcher $ MatchingFile $ FileInfo f f Nothing)
in ifM (matcher $ MatchingFile $ FileInfo f' f' Nothing) ( a (si, Right f)
( a (si, Right f')
, return Nothing , return Nothing
) )
Left k -> a (si, Left k) Left k -> a (si, Left k)
@ -177,7 +176,7 @@ batchFilesKeys fmt a = do
-- because in non-batch mode, that is done when -- because in non-batch mode, that is done when
-- CmdLine.Seek uses git ls-files. -- CmdLine.Seek uses git ls-files.
BatchFormat _ (BatchKeys False) -> BatchFormat _ (BatchKeys False) ->
Right . Right . fromRawFilePath Right . Right
<$$> liftIO . relPathCwdToFile . toRawFilePath <$$> liftIO . relPathCwdToFile . toRawFilePath
BatchFormat _ (BatchKeys True) -> \i -> BatchFormat _ (BatchKeys True) -> \i ->
pure $ case deserializeKey i of pure $ case deserializeKey i of