git-gui: Better handling of detached HEAD
git-gui: Better handling of detached HEAD

If the current branch is not a symbolic-ref that points to a
name in the refs/heads/ namespace we now just assume that the
head is a detached head.  In this case we return the special
branch name of HEAD rather than empty string, as HEAD is a
valid revision specification and the empty string is not.

I have also slightly improved the current-branch function by
using string functions to parse the symbolic-ref data.  This
should be slightly faster than using a regsub.  I think the
code is clearer too.

Signed-off-by: Shawn O. Pearce <f01032651c12a22b2103346ba96b3b6b231f9d3c@spearce.org>

destenson/git,destenson/git,destenson/git,destenson/git,destenson/git,destenson/git,destenson/git,destenson/git