aboutsummaryrefslogtreecommitdiff
path: root/Annex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-12 17:26:34 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-12 17:26:34 -0400
commita36c39ad0af168259948a360087d2ff05df2857e (patch)
tree5b7080890ca8d1ea3712f2c25c4faa88f54711da /Annex.hs
parentcad916d92695c7c04d3cdacbcd333a2dcd109d53 (diff)
getting files via http working!
Diffstat (limited to 'Annex.hs')
-rw-r--r--Annex.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/Annex.hs b/Annex.hs
index 7ac9932f1..68379cf20 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -14,6 +14,7 @@ module Annex (
import System.Posix.Files
import System.Directory
+import Data.String.Utils
import GitRepo
import Utility
import Locations
@@ -23,9 +24,14 @@ import UUID
import LocationLog
import Types
-{- An annexed file's content is stored somewhere under .git/annex/ -}
+{- An annexed file's content is stored somewhere under .git/annex/,
+ - based on the key. Since the symlink is user-visible, the filename
+ - used should be as close to the key as possible, in case the key is a
+ - filename or url. Just escape "/" in the key name, to keep a flat
+ - tree of files and avoid issues with files ending with "/" etc. -}
annexLocation :: GitRepo -> Key -> FilePath
-annexLocation repo key = gitDir repo ++ "/annex/" ++ key
+annexLocation repo key = gitDir repo ++ "/annex/" ++ (transform key)
+ where transform s = replace "/" "%" $ replace "%" "%%" s
{- On startup, examine the git repo, prepare it, and record state for
- later. -}