Skip to content

Commit

Permalink
Use git's suggested hash abbreviation to avoid conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Undo1 committed Feb 7, 2021
1 parent 7bf4ad2 commit e6e82ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions globalvars.py
Expand Up @@ -31,12 +31,12 @@

def git_commit_info():
try:
data = sp.check_output(['git', 'rev-list', '-1', '--pretty=%H%n%an%n%s', 'HEAD'],
data = sp.check_output(['git', 'rev-list', '-1', '--pretty=%h%n%H%n%an%n%s', 'HEAD'],
stderr=sp.STDOUT).decode('utf-8')
except sp.CalledProcessError as e:
raise OSError("Git error:\n" + e.output) from e
_, full_id, author, message = data.strip().split("\n")
return CommitInfo(id=full_id[:7], id_full=full_id, author=author, message=message)
_, abbrev_id, full_id, author, message = data.strip().split("\n")
return CommitInfo(id=abbrev_id, id_full=full_id, author=author, message=message)


def git_ref():
Expand Down

0 comments on commit e6e82ac

Please sign in to comment.