Remote branch name can now be resolved from detached HEAD.
silently fixing a bad malloc here too shhhhhhhhh