Fix branch name extraction

Instead of using basename, just remove the "refs/heads/" prefix.
With basename, branch names like "foo/bar" become just "bar".