diff --git a/Annex/Locations.hs b/Annex/Locations.hs index 058993cd29..a6af4d417f 100644 --- a/Annex/Locations.hs +++ b/Annex/Locations.hs @@ -452,15 +452,25 @@ preSanitizeKeyName = concatMap escape - can cause existing objects to get lost. -} keyFile :: Key -> FilePath -keyFile key = replace "/" "%" $ replace ":" "&c" $ - replace "%" "&s" $ replace "&" "&a" $ key2file key +keyFile = concatMap esc . key2file + where + esc '&' = "&a" + esc '%' = "&s" + esc ':' = "&c" + esc '/' = "%" + esc c = [c] {- Reverses keyFile, converting a filename fragment (ie, the basename of - the symlink target) into a key. -} fileKey :: FilePath -> Maybe Key -fileKey file = file2key $ - replace "&a" "&" $ replace "&s" "%" $ - replace "&c" ":" $ replace "%" "/" file +fileKey = file2key . unesc [] + where + unesc r [] = reverse r + unesc r ('%':cs) = unesc ('/':r) cs + unesc r ('&':'c':cs) = unesc (':':r) cs + unesc r ('&':'s':cs) = unesc ('%':r) cs + unesc r ('&':'a':cs) = unesc ('&':r) cs + unesc r (c:cs) = unesc (c:r) cs {- for quickcheck -} prop_isomorphic_fileKey :: String -> Bool diff --git a/CHANGELOG b/CHANGELOG index 4720141b55..6720725970 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +git-annex (6.20160924) UNRELEASED; urgency=medium + + * Optimisations to time it takes git-annex to walk working tree and find + files to work on. Sped up by around 18%. + + -- Joey Hess Mon, 26 Sep 2016 16:46:19 -0400 + git-annex (6.20160923) unstable; urgency=medium * Rate limit console progress display updates to 10 per second.