summaryrefslogtreecommitdiff
path: root/Locations.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-14 19:36:11 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-14 19:36:11 -0400
commitb8ba60428a0b4c077482560757e830e9ba02a823 (patch)
tree68c247edd2570d9121c150b35838f114eb9f994e /Locations.hs
parentc4959fee47f168857998dea6d11395158251158d (diff)
changed key to include backend name
Diffstat (limited to 'Locations.hs')
-rw-r--r--Locations.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/Locations.hs b/Locations.hs
index 7b8beb14f..960a8938d 100644
--- a/Locations.hs
+++ b/Locations.hs
@@ -22,18 +22,19 @@ gitStateDir :: Git.Repo -> FilePath
gitStateDir repo = (Git.workTree repo) ++ "/" ++ stateLoc ++ "/"
{- An annexed file's content is stored in
- - /path/to/repo/.git/annex/<backend>/<key>
+ - /path/to/repo/.git/annex/<key>, where <key> is of the form
+ - <backend:fragment>
-
- - (That allows deriving the key and backend by looking at the symlink to it.)
+ - That allows deriving the key and backend by looking at the symlink to it.
-}
-annexLocation :: Git.Repo -> Backend -> Key -> FilePath
-annexLocation r backend key =
- (Git.workTree r) ++ "/" ++ (annexLocationRelative r backend key)
+annexLocation :: Git.Repo -> Key -> FilePath
+annexLocation r key =
+ (Git.workTree r) ++ "/" ++ (annexLocationRelative r key)
{- Annexed file's location relative to the gitWorkTree -}
-annexLocationRelative :: Git.Repo -> Backend -> Key -> FilePath
-annexLocationRelative r backend key =
- Git.dir r ++ "/annex/" ++ (Backend.name backend) ++ "/" ++ (keyFile key)
+annexLocationRelative :: Git.Repo -> Key -> FilePath
+annexLocationRelative r key =
+ Git.dir r ++ "/annex/" ++ (keyFile key)
{- Converts a key into a filename fragment.
-
@@ -51,5 +52,5 @@ keyFile key = replace "/" "%" $ replace "%" "&s" $ replace "&" "&a" $ show key
{- Reverses keyFile, converting a filename fragment (ie, the basename of
- the symlink target) into a key. -}
fileKey :: FilePath -> Key
-fileKey file = Backend.Key $
+fileKey file = read $
replace "&a" "&" $ replace "&s" "%" $ replace "%" "/" file