diff options
author | 2012-05-18 18:30:50 -0400 | |
---|---|---|
committer | 2012-05-18 18:32:19 -0400 | |
commit | a1885bd11607d8668d70f81eaafa25e5341e8e8c (patch) | |
tree | ec568215f94c0c824c5a58f82fd0a7506987abb9 /Git | |
parent | eb6cb1b87f2d7016ddd4386e2a3bb20d8ea3c036 (diff) |
make GIT_DIR, GIT_WORK_TREE absolute
GIT_DIR is set to something relative, like ".git" in the pre-commit hook.
But internally all the directories are assumed to be absolute.
Diffstat (limited to 'Git')
-rw-r--r-- | Git/CurrentRepo.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Git/CurrentRepo.hs b/Git/CurrentRepo.hs index 4325f452c..746904caf 100644 --- a/Git/CurrentRepo.hs +++ b/Git/CurrentRepo.hs @@ -29,20 +29,22 @@ import qualified Git.Config -} get :: IO Repo get = do - gd <- takeenv "GIT_DIR" + gd <- pathenv "GIT_DIR" r <- configure gd =<< maybe fromCwd fromPath gd - wt <- maybe (worktree $ location r) Just <$> takeenv "GIT_WORK_TREE" + wt <- maybe (worktree $ location r) Just <$> pathenv "GIT_WORK_TREE" case wt of Nothing -> return r Just d -> do changeWorkingDirectory d return $ addworktree wt r where - takeenv s = do + pathenv s = do v <- getEnv s when (isJust v) $ unsetEnv s - return v + case v of + Nothing -> return Nothing + Just d -> Just <$> absPath d configure Nothing r = Git.Config.read r configure (Just d) r = do r' <- Git.Config.read r |