only try to clone repo for stable branch check if loc is a sha

Change-Id: I3283adfb117e64f24481372e8eca7d300afeab9a
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-08-11 12:06:58 -04:00
parent de5534cbe3
commit 837d6b610e

View File

@ -653,6 +653,16 @@ def validate_stable_branches(deliverable_info, workdir,
# The other rules aren't going to be testable, so skip them. # The other rules aren't going to be testable, so skip them.
continue continue
for repo, loc in sorted(location.items()): for repo, loc in sorted(location.items()):
if not is_a_hash(loc):
mk_error(
('tagless stable branches should be created '
'from commits by SHA but location %s for '
'branch %s of %s does not look '
'like a SHA' % (
(loc, repo, branch['name'])))
)
# We can't clone the location if it isn't a SHA.
continue
# Ensure we have a local copy of the repository so we # Ensure we have a local copy of the repository so we
# can scan for values that are more difficult to get # can scan for values that are more difficult to get
# remotely. # remotely.
@ -664,14 +674,6 @@ def validate_stable_branches(deliverable_info, workdir,
# No point in running extra checks if we can't # No point in running extra checks if we can't
# clone the repository. # clone the repository.
continue continue
if not is_a_hash(loc):
mk_error(
('tagless stable branches should be created '
'from commits by SHA but location %s for '
'branch %s of %s does not look '
'like a SHA' % (
(loc, repo, branch['name'])))
)
if not gitutils.commit_exists(workdir, repo, loc): if not gitutils.commit_exists(workdir, repo, loc):
mk_error( mk_error(
('stable branches should be created from merged ' ('stable branches should be created from merged '