summaryrefslogtreecommitdiff
path: root/Locations.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-10-05 13:49:45 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-10-05 13:49:45 -0400
commitf9c3d7562f1ddda3adb8aa892fd40584e9b48ac0 (patch)
treee70a7368c0e0cd04a7e0e305c5d827703ee38aba /Locations.hs
parent94697aaf725c50551ff91fa601fd7914a2fd5039 (diff)
move some code around
Diffstat (limited to 'Locations.hs')
-rw-r--r--Locations.hs30
1 files changed, 15 insertions, 15 deletions
diff --git a/Locations.hs b/Locations.hs
index 3ef5d7072..36104458e 100644
--- a/Locations.hs
+++ b/Locations.hs
@@ -1,6 +1,6 @@
{- git-annex file locations
-
- - Copyright 2010-2011 Joey Hess <joey@kitenet.net>
+ - Copyright 2010-2013 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -293,13 +293,26 @@ isLinkToAnnex s = (pathSeparator:objectDir) `isInfixOf` s
- a slash
- "%" is escaped to "&s", and "&" to "&a"; this ensures that the mapping
- is one to one.
- - ":" is escaped to "&c", because despite it being 2011, people still care
+ - ":" is escaped to "&c", because despite it being 20XX people still care
- about FAT.
-}
keyFile :: Key -> FilePath
keyFile key = replace "/" "%" $ replace ":" "&c" $
replace "%" "&s" $ replace "&" "&a" $ key2file key
+{- 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
+
+{- for quickcheck -}
+prop_idempotent_fileKey :: String -> Bool
+prop_idempotent_fileKey s = Just k == fileKey (keyFile k)
+ where
+ k = stubKey { keyName = s, keyBackendName = "test" }
+
{- A location to store a key on the filesystem. A directory hash is used,
- to protect against filesystems that dislike having many items in a
- single directory.
@@ -316,19 +329,6 @@ keyPath key hasher = hasher key </> f </> f
keyPaths :: Key -> [FilePath]
keyPaths key = map (keyPath key) annexHashes
-{- 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
-
-{- for quickcheck -}
-prop_idempotent_fileKey :: String -> Bool
-prop_idempotent_fileKey s = Just k == fileKey (keyFile k)
- where
- k = stubKey { keyName = s, keyBackendName = "test" }
-
{- Two different directory hashes may be used. The mixed case hash
- came first, and is fine, except for the problem of case-strict
- filesystems such as Linux VFAT (mounted with shortname=mixed),