ensure that gitdir is absolute

calcGitLink turns out to need it to be absolute, and it normally is,
but not if it's read from a .git file in a submodule, or perhaps from
GIT_DIR.

I should look into dropping this invariant.
This commit is contained in:
Joey Hess 2012-10-16 16:23:50 -04:00
parent 509692847a
commit 4f95cc8ef1
2 changed files with 7 additions and 3 deletions

View file

@ -227,7 +227,8 @@ checkForRepo dir =
catchDefaultIO "" (readFile $ dir </> ".git")
return $ if gitdirprefix `isPrefixOf` c
then Just $ Local
{ gitdir = drop (length gitdirprefix) c
{ gitdir = absPathFrom dir $
drop (length gitdirprefix) c
, worktree = Just dir
}
else Nothing