fixing update_head in gitlab_projects for issue#5408 (at gitlabhq/gitlabhq) #98
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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 might be unnecessary, these lines just check if this command executes successfully. And then actually checks the output of git show-ref if it is empty or not.
My apologies in advance if there is some mistake, as I never programmed/touched ruby before and these few lines are my first attempt.