pmb.helpers.git.rev_parse: add path argument (!1848)

This commit is contained in:
Oliver Smith 2019-12-24 12:40:16 +01:00 committed by Alexey Min
parent 2b1dfe7cfc
commit 9ca06bc6c2
No known key found for this signature in database
GPG key ID: EBF5ECFFFEE34DED
2 changed files with 6 additions and 5 deletions

View file

@ -55,12 +55,13 @@ def clone(args, name_repo, shallow=True):
pmb.helpers.run.user(args, command, output="stdout")
def rev_parse(args, revision="HEAD"):
""" Run "git rev-parse" in the pmaports.git dir.
def rev_parse(args, path, revision="HEAD"):
""" Run "git rev-parse" in a specific repository dir.
:param path: to the git repository
:returns: commit string like "90cd0ad84d390897efdcf881c0315747a4f3a966"
"""
rev = pmb.helpers.run.user(args, ["git", "rev-parse", revision],
args.aports, output_return=True)
rev = pmb.helpers.run.user(args, ["git", "rev-parse", revision], path,
output_return=True)
return rev.rstrip()