Fix a potential failure to parse git config
Git has an obnoxious special case in git config, a line "foo" is the same as "foo = true". That means there is no way to examine the output of git config and tell if it was run with --null or not, since a "foo" in the first line could be such a boolean, or could be followed by its value on the next line if --null were used. So, rather than trying to do such a detection, track the style of config at all the points where it's generated.
This commit is contained in:
parent
fbd78cff64
commit
ca9c6c5f60
7 changed files with 31 additions and 32 deletions
|
@ -249,7 +249,7 @@ tryGitConfigRead autoinit r
|
|||
| haveconfig r = return r -- already read
|
||||
| Git.repoIsSsh r = storeUpdatedRemote $ do
|
||||
v <- Ssh.onRemote NoConsumeStdin r
|
||||
(pipedconfig autoinit (Git.repoDescribe r), return (Left $ giveup "configlist failed"))
|
||||
(pipedconfig Git.Config.ConfigList autoinit (Git.repoDescribe r), return (Left $ giveup "configlist failed"))
|
||||
"configlist" [] configlistfields
|
||||
case v of
|
||||
Right r'
|
||||
|
@ -264,8 +264,8 @@ tryGitConfigRead autoinit r
|
|||
where
|
||||
haveconfig = not . M.null . Git.config
|
||||
|
||||
pipedconfig mustincludeuuuid configloc cmd params = do
|
||||
v <- liftIO $ Git.Config.fromPipe r cmd params
|
||||
pipedconfig st mustincludeuuuid configloc cmd params = do
|
||||
v <- liftIO $ Git.Config.fromPipe r cmd params st
|
||||
case v of
|
||||
Right (r', val, _err) -> do
|
||||
unless (isUUIDConfigured r' || S.null val || not mustincludeuuuid) $ do
|
||||
|
@ -282,7 +282,7 @@ tryGitConfigRead autoinit r
|
|||
liftIO $ hClose h
|
||||
let url = Git.repoLocation r ++ "/config"
|
||||
ifM (liftIO $ Url.downloadQuiet nullMeterUpdate url tmpfile uo)
|
||||
( Just <$> pipedconfig False url "git" [Param "config", Param "--null", Param "--list", Param "--file", File tmpfile]
|
||||
( Just <$> pipedconfig Git.Config.ConfigNullList False url "git" [Param "config", Param "--null", Param "--list", Param "--file", File tmpfile]
|
||||
, return Nothing
|
||||
)
|
||||
case v of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue