avoid unnecessary chdir
This commit is contained in:
parent
1f66af2b53
commit
92a4af8b20
1 changed files with 5 additions and 2 deletions
|
@ -30,8 +30,11 @@ read repo@(Repo { location = Dir d }) = do
|
||||||
{- Cannot use pipeRead because it relies on the config having
|
{- Cannot use pipeRead because it relies on the config having
|
||||||
been already read. Instead, chdir to the repo. -}
|
been already read. Instead, chdir to the repo. -}
|
||||||
cwd <- getCurrentDirectory
|
cwd <- getCurrentDirectory
|
||||||
bracket_ (changeWorkingDirectory d) (changeWorkingDirectory cwd) $
|
if dirContains d cwd
|
||||||
pOpen ReadFromPipe "git" ["config", "--null", "--list"] $
|
then go
|
||||||
|
else bracket_ (changeWorkingDirectory d) (changeWorkingDirectory cwd) go
|
||||||
|
where
|
||||||
|
go = pOpen ReadFromPipe "git" ["config", "--null", "--list"] $
|
||||||
hRead repo
|
hRead repo
|
||||||
read r = assertLocal r $
|
read r = assertLocal r $
|
||||||
error $ "internal error; trying to read config of " ++ show r
|
error $ "internal error; trying to read config of " ++ show r
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue