common.get_head_commit_id() to get string commit ID from HEAD

This commit is contained in:
Hans-Christoph Steiner 2020-02-18 10:36:28 +01:00
parent fafaa8f81f
commit 5459a461db
No known key found for this signature in database
GPG key ID: 3E177817BA1B9BFA
2 changed files with 9 additions and 4 deletions

View file

@ -670,6 +670,14 @@ def get_build_dir(app):
return os.path.join('build', app.id)
def get_head_commit_id(git_repo):
"""Get git commit ID for HEAD as a str
repo.head.commit.binsha is a bytearray stored in a str
"""
return hexlify(bytearray(git_repo.head.commit.binsha)).decode()
def setup_vcs(app):
'''checkout code from VCS and return instance of vcs and the build dir'''
build_dir = get_build_dir(app)