summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex.hs2
-rw-r--r--GitRepo.hs10
-rw-r--r--Locations.hs9
3 files changed, 12 insertions, 9 deletions
diff --git a/Annex.hs b/Annex.hs
index e5eb1894f..1c369be92 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -59,7 +59,7 @@ annexFile state file = do
let dest = annexLocation state backend key
createDirectoryIfMissing True (parentDir dest)
renameFile file dest
- createSymbolicLink dest file
+ createSymbolicLink (annexLocationRelative state backend key) file
gitRun (repo state) ["add", file]
gitRun (repo state) ["commit", "-m",
("git-annex annexed " ++ file), file]
diff --git a/GitRepo.hs b/GitRepo.hs
index fcaae1253..f0686ff20 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -98,14 +98,12 @@ gitAttributes repo = assertlocal repo $ do
then (top repo) ++ "/info/.gitattributes"
else (top repo) ++ "/.gitattributes"
-{- Path to a repository's .git directory.
- - (For a bare repository, that is the root of the repository.)
- - TODO: support GIT_DIR -}
+{- Path to a repository's .git directory, relative to its topdir. -}
gitDir :: GitRepo -> String
gitDir repo = assertlocal repo $
if (bare repo)
- then top repo
- else top repo ++ "/.git"
+ then ""
+ else ".git"
{- Path to a repository's --work-tree. -}
gitWorkTree :: GitRepo -> FilePath
@@ -130,7 +128,7 @@ gitRelative repo file = drop (length absrepo) absfile
gitCommandLine :: GitRepo -> [String] -> [String]
gitCommandLine repo params = assertlocal repo $
-- force use of specified repo via --git-dir and --work-tree
- ["--git-dir="++(gitDir repo), "--work-tree="++(top repo)] ++ params
+ ["--git-dir="++(top repo)++"/"++(gitDir repo), "--work-tree="++(top repo)] ++ params
{- Runs git in the specified repo. -}
gitRun :: GitRepo -> [String] -> IO ()
diff --git a/Locations.hs b/Locations.hs
index b859fd2f2..faf29235f 100644
--- a/Locations.hs
+++ b/Locations.hs
@@ -5,7 +5,8 @@ module Locations (
gitStateDir,
stateLoc,
keyFile,
- annexLocation
+ annexLocation,
+ annexLocationRelative
) where
import Data.String.Utils
@@ -28,6 +29,10 @@ keyFile key = replace "/" "&s" $ replace "&" "&a" key
- .git/annex/<backend>/<key> ; this allows deriving the key and backend
- by looking at the symlink to it. -}
annexLocation :: State -> Backend -> Key -> FilePath
-annexLocation state backend key =
+annexLocation state backend key =
+ (gitWorkTree $ repo state) ++ "/" ++
+ (annexLocationRelative state backend key)
+annexLocationRelative :: State -> Backend -> Key -> FilePath
+annexLocationRelative state backend key =
gitDir (repo state) ++ "/annex/" ++ (name backend) ++
"/" ++ (keyFile key)