make gitDir absolute

This commit is contained in:
Joey Hess 2011-08-19 12:59:07 -04:00
parent 7cedd28ab0
commit e97fede8cd
3 changed files with 8 additions and 8 deletions

12
Git.hs
View file

@ -247,11 +247,11 @@ attributes repo
| configBare repo = workTree repo ++ "/info/.gitattributes" | configBare repo = workTree repo ++ "/info/.gitattributes"
| otherwise = workTree repo ++ "/.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 -> String
gitDir repo gitDir repo
| configBare repo = "" | configBare repo = workTree repo
| otherwise = ".git" | otherwise = workTree repo </> ".git"
{- Path to a repository's --work-tree, that is, its top. {- 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. -} {- Constructs a git command line operating on the specified repo. -}
gitCommandLine :: Repo -> [CommandParam] -> [CommandParam] 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 -- force use of specified repo via --git-dir and --work-tree
[ Param ("--git-dir=" ++ d ++ "/" ++ gitDir repo) [ Param ("--git-dir=" ++ gitDir repo)
, Param ("--work-tree=" ++ d) , Param ("--work-tree=" ++ workTree repo)
] ++ params ] ++ params
gitCommandLine repo _ = assertLocal repo $ error "internal" gitCommandLine repo _ = assertLocal repo $ error "internal"

View file

@ -79,7 +79,7 @@ unlessBare a = do
preCommitHook :: Annex FilePath preCommitHook :: Annex FilePath
preCommitHook = do preCommitHook = do
g <- Annex.gitRepo g <- Annex.gitRepo
return $ Git.workTree g ++ "/" ++ Git.gitDir g ++ "/hooks/pre-commit" return $ Git.gitDir g ++ "/hooks/pre-commit"
preCommitScript :: String preCommitScript :: String
preCommitScript = preCommitScript =

View file

@ -20,7 +20,7 @@ usage :: IO a
usage = error $ "bad parameters\n\n" ++ header usage = error $ "bad parameters\n\n" ++ header
tmpIndex :: Git.Repo -> FilePath 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 :: Git.Repo -> IO ()
setup g = cleanup g -- idempotency setup g = cleanup g -- idempotency