Disable print for git for-each-ref in git_cache

The command is used for verification purposes when git index is fetched
from GS. The output is verbose for chromium/src and not useful at all.

R=gavinmak@google.com

Bug: 1255228
Change-Id: Ie95963a23ef397e9fd6ce7bcf959ec9964d21ba7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3227145
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
changes/45/3227145/2
Josip Sokcevic 4 years ago committed by LUCI CQ
parent 3e50cf453e
commit 650f853ced

@ -231,11 +231,12 @@ class Mirror(object):
name='rename [%s] => [%s]' % (src, dst),
printerr=self.print)
def RunGit(self, cmd, **kwargs):
def RunGit(self, cmd, print_stdout=True, **kwargs):
"""Run git in a subprocess."""
cwd = kwargs.setdefault('cwd', self.mirror_path)
kwargs.setdefault('print_stdout', False)
kwargs.setdefault('filter_fn', self.print)
if print_stdout:
kwargs.setdefault('filter_fn', self.print)
env = kwargs.get('env') or kwargs.setdefault('env', os.environ.copy())
env.setdefault('GIT_ASKPASS', 'true')
env.setdefault('SSH_ASKPASS', 'true')
@ -320,7 +321,7 @@ class Mirror(object):
# Set HEAD to main.
self.RunGit(['symbolic-ref', 'HEAD', 'refs/heads/main'], cwd=tempdir)
# A quick validation that all references are valid.
self.RunGit(['for-each-ref'], cwd=tempdir)
self.RunGit(['for-each-ref'], print_stdout=False, cwd=tempdir)
except Exception as e:
self.print('Encountered error: %s' % str(e), file=sys.stderr)
gclient_utils.rmtree(tempdir)

Loading…
Cancel
Save