From ddf6973d222d94bfc50cae1b606dfc8022fe12e8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 22 Nov 2019 19:13:05 -0400 Subject: [PATCH] minor optimisation avoid repeated scan of the same bytestring --- Annex/Locations.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Annex/Locations.hs b/Annex/Locations.hs index ac993ce387..f9c65732e8 100644 --- a/Annex/Locations.hs +++ b/Annex/Locations.hs @@ -563,7 +563,7 @@ keyFile = fromRawFilePath . keyFile' keyFile' :: Key -> RawFilePath keyFile' k = let b = serializeKey' k - in if any (`S8.elem` b) ['&', '%', ':', '/'] + in if S8.any (`elem` ['&', '%', ':', '/']) b then S8.concatMap esc b else b where @@ -573,6 +573,7 @@ keyFile' k = esc '/' = "%" esc c = S8.singleton c + {- Reverses keyFile, converting a filename fragment (ie, the basename of - the symlink target) into a key. -} fileKey :: FilePath -> Maybe Key