Verify SHA in Shippable change detection.

This commit is contained in:
Matt Clay 2017-03-15 11:10:50 -07:00
parent 273786d0bd
commit 5e9a2b8528
2 changed files with 18 additions and 3 deletions

View file

@ -4,6 +4,7 @@ from __future__ import absolute_import, print_function
from lib.util import (
CommonConfig,
SubprocessError,
run_command,
)
@ -55,6 +56,18 @@ class Git(object):
cmd = ['merge-base', '--fork-point', branch]
return self.run_git(cmd).strip()
def is_valid_ref(self, ref):
"""
:type ref: str
:rtype: bool
"""
cmd = ['show', ref]
try:
self.run_git(cmd)
return True
except SubprocessError:
return False
def run_git_split(self, cmd, separator=None):
"""
:type cmd: list[str]