Fix error when "master" dosen't exist.

It should fix https://github.com/gitlabhq/gitlabhq/issues/1268.