aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Git/Construct.hs3
-rw-r--r--Git/CurrentRepo.hs7
-rw-r--r--Utility/Directory.hs11
3 files changed, 7 insertions, 14 deletions
diff --git a/Git/Construct.hs b/Git/Construct.hs
index 3c1cfdbdf..3d39b0801 100644
--- a/Git/Construct.hs
+++ b/Git/Construct.hs
@@ -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
diff --git a/Git/CurrentRepo.hs b/Git/CurrentRepo.hs
index f82241ae2..908cc389e 100644
--- a/Git/CurrentRepo.hs
+++ b/Git/CurrentRepo.hs
@@ -51,8 +51,11 @@ get = do
configure (Just d) r = do
r' <- Git.Config.read r
-- Let GIT_DIR override the default gitdir.
- return $ changelocation r' $
- Local { gitdir = d, worktree = worktree (location r') }
+ absd <- absPath d
+ return $ changelocation r' $ Local
+ { gitdir = absd
+ , worktree = worktree (location r')
+ }
addworktree w r = changelocation r $
Local { gitdir = gitdir (location r), worktree = w }
changelocation r l = r { location = l }
diff --git a/Utility/Directory.hs b/Utility/Directory.hs
index e6609caf9..cf72952d6 100644
--- a/Utility/Directory.hs
+++ b/Utility/Directory.hs
@@ -94,14 +94,3 @@ moveFile src dest = tryIO (rename src dest) >>= onrename
- cannot be removed. -}
nukeFile :: FilePath -> IO ()
nukeFile file = whenM (doesFileExist file) $ removeFile file
-
-{- Runs an action in another directory. -}
-bracketCd :: FilePath -> IO a -> IO a
-bracketCd dir a = go =<< getCurrentDirectory
- where
- go cwd
- | dirContains dir cwd = a
- | otherwise = bracket_
- (changeWorkingDirectory dir)
- (changeWorkingDirectory cwd)
- a