Fix branch name extraction

Instead of using basename, just remove the "refs/heads/" prefix.
With basename, branch names like "foo/bar" become just "bar".
Merge pull request #50 from jjlin/contrib

Fix branch name extraction