Backport #21791
There was a bug introduced in #21352 due to a change of behaviour caused
by #19280. This causes a panic on running the default doctor checks
because the panic introduced by #19280 assumes that the only way
opts.StdOut and opts.Stderr can be set in RunOpts is deliberately.
Unfortunately, when running a git.Command the provided RunOpts can be
set, therefore if you share a common set of RunOpts these two values can
be set by the previous commands.
This PR stops using common RunOpts for the commands in that doctor check
but secondly stops RunCommand variants from changing the provided
RunOpts.
Signed-off-by: Andrew Thornton <art27@cantab.net>
logger.Info("Out of %d repos, HEADs for %d are now fixed and HEADS for %d are still broken",numRepos,numReposUpdated,numDefaultBranchesBroken+numHeadsBroken-numReposUpdated)
logger.Info("Out of %d repos, HEADs for %d are now fixed and HEADS for %d are still broken",numRepos,numReposUpdated,numDefaultBranchesBroken+numHeadsBroken-numReposUpdated)
}else{
}else{
ifnumHeadsBroken==0&&numDefaultBranchesBroken==0{
ifnumHeadsBroken==0&&numDefaultBranchesBroken==0{
logger.Info("All %d repos have their HEADs in the correct state")
logger.Info("All %d repos have their HEADs in the correct state",numRepos)
}else{
}else{
ifnumHeadsBroken==0&&numDefaultBranchesBroken!=0{
ifnumHeadsBroken==0&&numDefaultBranchesBroken!=0{
logger.Critical("Default branches are broken for %d/%d repos",numDefaultBranchesBroken,numRepos)
logger.Critical("Default branches are broken for %d/%d repos",numDefaultBranchesBroken,numRepos)