Patch Set 1:

yeah, this sounds good. In the mean time I tried with c git and found that it returns master if multiple branches point at the same commit HEAD refers to, so ignore my previous comment.