diff options
author | Joey Hess <joey@kitenet.net> | 2011-04-02 15:50:51 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-04-02 15:50:51 -0400 |
commit | f005a84e5675cb3e551b2922ad42642df28264d6 (patch) | |
tree | 676305c323a4eb61e01b2c4212b9e63b5fc9d8b0 /Locations.hs | |
parent | 00b9a9a25d6032a29c053f970e861a8ee5fd3bf8 (diff) |
add loggedKeys
Diffstat (limited to 'Locations.hs')
-rw-r--r-- | Locations.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Locations.hs b/Locations.hs index 6c413a218..f263ea526 100644 --- a/Locations.hs +++ b/Locations.hs @@ -21,6 +21,7 @@ module Locations ( isLinkToAnnex, logFile, logFileOld, + logFileKey, hashDirMixed, prop_idempotent_fileKey @@ -127,6 +128,14 @@ logFile' :: (Key -> FilePath) -> Git.Repo -> Key -> String logFile' hasher repo key = gitStateDir repo ++ hasher key ++ keyFile key ++ ".log" +{- Converts a log filename into a key. -} +logFileKey :: FilePath -> Maybe Key +logFileKey file + | end == ".log" = readKey beginning + | otherwise = Nothing + where + (beginning, end) = splitAt (length file - 4) file + {- Converts a key into a filename fragment. - - Escape "/" in the key name, to keep a flat tree of files and avoid |