fixing update_head in gitlab_projects for issue#5408(gitlabhq/gitlabhq)

Please have a look at discussion this issue https://github.com/gitlabhq/gitlabhq/issues/5408 in **gitlabhq/gitlabhq**.

Although this fix is enough for the part which gitlab_shell is doing, but after changing the default branch in project settings if you directly goto **Files** or **Commits**, the selected branch in dropdown is still the old one. So if you goto project home once and come back to **Files** or **Commits** then selected branch in dropdown is updated to default one. And I think this has to do something with updating project model about the default_branch.

Here Line#169..172 checks the output of **git show-ref** if it is empty or not, and thus validates the availability of the supplied ref.

My apologies in advance if there is some mistake, as I never programmed/touched ruby before and these few lines are my first attempt. yesterday I submitted another PR for same thing but I didn't validate the tests, this time I ran the tests, it was all ok.