twidi/prwd — comment on commit 6a7b8d85d0342f30f91287a802c2d248baa13e28
File: main.c line 520
By tamentis:

Not completely sure what's the best way to do that. The mercurial file is straightforward and git's HEAD isn't quite its equivalent. I fear you will have to do a little more parsing to get it useful.

First you would need to detect ref:, split the remaining part and get the last token (master, or the branch name). In the case where HEAD doesn't contain ref:, you would probably want the first 8 characters of the string.