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:
parent
509692847a
commit
4f95cc8ef1
2 changed files with 7 additions and 3 deletions
|
@ -227,7 +227,8 @@ checkForRepo dir =
|
||||||
catchDefaultIO "" (readFile $ dir </> ".git")
|
catchDefaultIO "" (readFile $ dir </> ".git")
|
||||||
return $ if gitdirprefix `isPrefixOf` c
|
return $ if gitdirprefix `isPrefixOf` c
|
||||||
then Just $ Local
|
then Just $ Local
|
||||||
{ gitdir = drop (length gitdirprefix) c
|
{ gitdir = absPathFrom dir $
|
||||||
|
drop (length gitdirprefix) c
|
||||||
, worktree = Just dir
|
, worktree = Just dir
|
||||||
}
|
}
|
||||||
else Nothing
|
else Nothing
|
||||||
|
|
|
@ -51,8 +51,11 @@ get = do
|
||||||
configure (Just d) r = do
|
configure (Just d) r = do
|
||||||
r' <- Git.Config.read r
|
r' <- Git.Config.read r
|
||||||
-- Let GIT_DIR override the default gitdir.
|
-- Let GIT_DIR override the default gitdir.
|
||||||
return $ changelocation r' $
|
absd <- absPath d
|
||||||
Local { gitdir = d, worktree = worktree (location r') }
|
return $ changelocation r' $ Local
|
||||||
|
{ gitdir = absd
|
||||||
|
, worktree = worktree (location r')
|
||||||
|
}
|
||||||
addworktree w r = changelocation r $
|
addworktree w r = changelocation r $
|
||||||
Local { gitdir = gitdir (location r), worktree = w }
|
Local { gitdir = gitdir (location r), worktree = w }
|
||||||
changelocation r l = r { location = l }
|
changelocation r l = r { location = l }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue