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
|
||||
been already read. Instead, chdir to the repo. -}
|
||||
cwd <- getCurrentDirectory
|
||||
bracket_ (changeWorkingDirectory d) (changeWorkingDirectory cwd) $
|
||||
pOpen ReadFromPipe "git" ["config", "--null", "--list"] $
|
||||
if dirContains d cwd
|
||||
then go
|
||||
else bracket_ (changeWorkingDirectory d) (changeWorkingDirectory cwd) go
|
||||
where
|
||||
go = pOpen ReadFromPipe "git" ["config", "--null", "--list"] $
|
||||
hRead repo
|
||||
read r = assertLocal r $
|
||||
error $ "internal error; trying to read config of " ++ show r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue