Utilize full branch name when checking permissions.

fixes gitlabhq/gitlabhq#3775

ExitCodeMatchers from https://gist.github.com/stevenharman/2355172