fix detection of current branch name from output of git where the current branch isn't the first in the list