repo: Do not even try to set up GPG with opt.no_repo_verify

In order to be able to use "--no-repo-verify" to work around an issue with
gpg-agent and long socket paths (see e.g. [1]), this change avoids GPG
being set up at all if that option is passed.

[1] https://github.com/elastic/elasticsearch/issues/17053

Change-Id: I1e5cbd8be2dc0084f12afe0ca33c789fdbc6fef9
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/251108
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Sebastian Schuberth 2020-01-20 11:42:48 +01:00 committed by Mike Frysinger
parent 0eb2d3c8a0
commit 8f997b38cb

11
repo
View File

@ -366,15 +366,18 @@ def _Init(args, gitc_init=False):
_CheckGitVersion() _CheckGitVersion()
try: try:
if NeedSetupGnuPG(): if opt.no_repo_verify:
can_verify = SetupGnuPG(opt.quiet) do_verify = False
else: else:
can_verify = True if NeedSetupGnuPG():
do_verify = SetupGnuPG(opt.quiet)
else:
do_verify = True
dst = os.path.abspath(os.path.join(repodir, S_repo)) dst = os.path.abspath(os.path.join(repodir, S_repo))
_Clone(url, dst, opt.quiet, not opt.no_clone_bundle) _Clone(url, dst, opt.quiet, not opt.no_clone_bundle)
if can_verify and not opt.no_repo_verify: if do_verify:
rev = _Verify(dst, branch, opt.quiet) rev = _Verify(dst, branch, opt.quiet)
else: else:
rev = 'refs/remotes/origin/%s^0' % branch rev = 'refs/remotes/origin/%s^0' % branch