From e97fede8cd86d0eb804ced6d2877f617ba15b1a6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 19 Aug 2011 12:59:07 -0400 Subject: [PATCH] make gitDir absolute --- Git.hs | 12 ++++++------ Init.hs | 2 +- git-union-merge.hs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Git.hs b/Git.hs index b226bce0f2..168fe4154e 100644 --- a/Git.hs +++ b/Git.hs @@ -247,11 +247,11 @@ attributes repo | configBare repo = workTree repo ++ "/info/.gitattributes" | otherwise = workTree repo ++ "/.gitattributes" -{- Path to a repository's .git directory, relative to its workTree. -} +{- Path to a repository's .git directory. -} gitDir :: Repo -> String gitDir repo - | configBare repo = "" - | otherwise = ".git" + | configBare repo = workTree repo + | otherwise = workTree repo ".git" {- Path to a repository's --work-tree, that is, its top. - @@ -345,10 +345,10 @@ urlAuthPart _ repo = assertUrl repo $ error "internal" {- Constructs a git command line operating on the specified repo. -} gitCommandLine :: Repo -> [CommandParam] -> [CommandParam] -gitCommandLine repo@(Repo { location = Dir d} ) params = +gitCommandLine repo@(Repo { location = Dir _ } ) params = -- force use of specified repo via --git-dir and --work-tree - [ Param ("--git-dir=" ++ d ++ "/" ++ gitDir repo) - , Param ("--work-tree=" ++ d) + [ Param ("--git-dir=" ++ gitDir repo) + , Param ("--work-tree=" ++ workTree repo) ] ++ params gitCommandLine repo _ = assertLocal repo $ error "internal" diff --git a/Init.hs b/Init.hs index 4708701fa7..a469657a11 100644 --- a/Init.hs +++ b/Init.hs @@ -79,7 +79,7 @@ unlessBare a = do preCommitHook :: Annex FilePath preCommitHook = do g <- Annex.gitRepo - return $ Git.workTree g ++ "/" ++ Git.gitDir g ++ "/hooks/pre-commit" + return $ Git.gitDir g ++ "/hooks/pre-commit" preCommitScript :: String preCommitScript = diff --git a/git-union-merge.hs b/git-union-merge.hs index e763376077..4e1a932b45 100644 --- a/git-union-merge.hs +++ b/git-union-merge.hs @@ -20,7 +20,7 @@ usage :: IO a usage = error $ "bad parameters\n\n" ++ header tmpIndex :: Git.Repo -> FilePath -tmpIndex g = Git.workTree g Git.gitDir g "index.git-union-merge" +tmpIndex g = Git.gitDir g "index.git-union-merge" setup :: Git.Repo -> IO () setup g = cleanup g -- idempotency