Get git commit id also in detached head mode.

This commit is contained in:
Norman Jäckel 2012-11-28 18:02:33 +01:00
parent 589c209c79
commit d53017eea8

View File

@ -40,7 +40,7 @@ def get_git_commit_id():
"""
try:
git_head = open('.git/HEAD', 'r').read().rstrip()
if True: #starts with 'ref: '
if git_head[:5] == 'ref: ':
git_commit_id = open('.git/%s' % git_head[5:], 'r').read().rstrip()
else:
git_commit_id = git_head