start: do not swallow git output all the time

Normally git produces no output when creating or switching branches.
If there's a problem though, we want to show that to the user.  So
switch from capturing all output to running in quiet mode.

Bug: https://crbug.com/gerrit/15819
Change-Id: I7873ecc7c3bacce591899cc9471cb0244eb74541
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343454
Reviewed-by: LaMont Jones <lamontjones@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger 2022-08-18 09:17:09 -04:00
parent 3c2d807905
commit ad1b7bd2e2

View File

@ -1678,10 +1678,7 @@ class Project(object):
all_refs = self.bare_ref.all all_refs = self.bare_ref.all
if R_HEADS + name in all_refs: if R_HEADS + name in all_refs:
return GitCommand(self, return GitCommand(self, ['checkout', '-q', name, '--']).Wait() == 0
['checkout', name, '--'],
capture_stdout=True,
capture_stderr=True).Wait() == 0
branch = self.GetBranch(name) branch = self.GetBranch(name)
branch.remote = self.GetRemote() branch.remote = self.GetRemote()
@ -1706,10 +1703,7 @@ class Project(object):
branch.Save() branch.Save()
return True return True
if GitCommand(self, if GitCommand(self, ['checkout', '-q', '-b', branch.name, revid]).Wait() == 0:
['checkout', '-b', branch.name, revid],
capture_stdout=True,
capture_stderr=True).Wait() == 0:
branch.Save() branch.Save()
return True return True
return False return False