Skip to content

Commit

Permalink
Make the git version checker look at packed refs if there is no loose…
Browse files Browse the repository at this point in the history
… ref.
  • Loading branch information
stump committed Aug 11, 2010
1 parent 14503e4 commit 99d65bb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Version.py
Expand Up @@ -40,8 +40,15 @@ def _getTagLine():
if VFS.isdir('/gameroot/.git'):
# HEAD is in the form "ref: refs/heads/master\n"
headref = VFS.open('/gameroot/.git/HEAD').read()[5:].strip()
# The ref is in the form "sha1-hash\n"
headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
if VFS.isfile('/gameroot/.git/' + headref):
# The ref is in the form "sha1-hash\n"
headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
else:
# It's a packed ref.
for line in VFS.open('/gameroot/.git/packed-refs'):
if line.strip().endswith(headref):
headhash = line[:40]
break
shortref = re.sub('^refs/(heads/)?', '', headref)
return 'development (git %s %s)' % (shortref, headhash[:7])

Expand Down

0 comments on commit 99d65bb

Please sign in to comment.