gitlab-org--gitlab-foss/spec/helpers
Valery Sizov bbbcc9657f Merge branch 'fix-error-500-when-no-head' into 'master'
Fix error 500 when no HEAD is available

Steps to reproduce:

1. Create a project with a README
2. In the actual remote, type: `git symbolic-ref HEAD refs/heads/nowhere`
3. Check that HEAD is gone via `git ls-remote .`
4. Go to the projects page and see the Error 500

Error:

```
NoMethodError - undefined method `sha' for nil:NilClass:
  app/helpers/projects_helper.rb:281:in `readme_cache_key'
  app/views/projects/_readme.html.haml:10:in `_app_views_projects__readme_html_haml___2036282917939462960_70154565285700'
  actionview (4.1.11) lib/action_view/template.rb:145:in `block in render'
  activesupport (4.1.11) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.1.11) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.1.11) lib/active_support/notifications.rb:159:in `instrument'
  actionview (4.1.11) lib/action_view/template.rb:339:in `instrument'
  actionview (4.1.11) lib/action_view/template.rb:143:in `render'
  rack-mini-profiler (0.9.0) lib/mini_profiler/profiling_methods.rb:108:in `block in profile_method'
  actionview (4.1.11) lib/action_view/renderer/partial_renderer.rb:306:in `render_partial'
  actionview (4.1.11) lib/action_view/renderer/partial_renderer.rb:279:in `block in render'
  actionview (4.1.11) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
  activesupport (4.1.11) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.1.11) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.1.11) lib/active_support/notifications.rb:159:in `instrument'
  actionview (4.1.11) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
  actionview (4.1.11) lib/action_view/renderer/partial_renderer.rb:278:in `render'
  actionview (4.1.11) lib/action_view/renderer/renderer.rb:47:in `render_partial'
  actionview (4.1.11) lib/action_view/helpers/rendering_helper.rb:35:in `render'
  haml (4.0.5) lib/haml/helpers/action_view_mods.rb:10:in `block in render_with_haml'
  haml (4.0.5) lib/haml/helpers.rb:89:in `non_haml'
  haml (4.0.5) lib/haml/helpers/action_view_mods.rb:10:in `render_with_haml'
  app/views/projects/show.html.haml:47:in `_app_views_projects_show_html_haml__1458303859692972698_70154948164180'
  actionview (4.1.11) lib/action_view/template.rb:145:in `block in render'
  activesupport (4.1.11) lib/active_support/notifications.rb:159:in `block in instrument'
```

Closes https://github.com/gitlabhq/gitlabhq/issues/9484, but there may be some other issue there.

See merge request !1041
2015-07-24 20:18:14 +00:00
..
application_helper_spec.rb Fix ApplicationHelper specs 2015-06-30 17:47:53 -04:00
auth_helper_spec.rb Allow custom label to be set for authentication providers. 2015-07-23 15:20:12 +02:00
blob_helper_spec.rb Fix git blame syntax highlighting when different commits break up lines 2015-05-27 14:10:58 -07:00
broadcast_messages_helper_spec.rb Update mock and stub syntax for specs 2015-06-22 12:13:46 +02:00
diff_helper_spec.rb Update mock and stub syntax for specs 2015-06-22 12:13:46 +02:00
emails_helper_spec.rb Explain reset token expiration in emails 2015-05-16 14:03:07 -06:00
events_helper_spec.rb Fix code preview theme setting for comments, issues, merge requests, and snippets. 2015-03-10 08:11:20 -07:00
gitlab_markdown_helper_spec.rb Fixed the issues 2015-07-09 13:38:33 -07:00
groups_helper.rb Fix avatar tests to use banana_sample.gif since SVG is not supported 2015-06-22 12:04:07 -07:00
icons_helper_spec.rb Check symlink mode as a String for file_type_icon_class 2015-04-01 23:34:33 -04:00
issues_helper_spec.rb Remove title_for_issue helper 2015-04-30 17:27:33 -04:00
labels_helper_spec.rb Add link_to_label helper 2015-05-21 23:40:25 -04:00
merge_requests_helper.rb Updated rspec to rspec 3.x syntax 2015-02-12 19:17:35 +01:00
nav_helper_spec.rb Adds persistent collapse button for left side bar 2015-02-03 11:45:33 -05:00
notifications_helper_spec.rb Update mock and stub syntax for specs 2015-06-22 12:13:46 +02:00
preferences_helper_spec.rb Fix Style/HashSyntax violations 2015-06-22 14:54:33 -04:00
projects_helper_spec.rb Fix Error 500 when browsing projects with no HEAD 2015-07-24 10:14:58 -07:00
search_helper_spec.rb Updated rspec to rspec 3.x syntax 2015-02-12 19:17:35 +01:00
submodule_helper_spec.rb Fix Error 500 when relative submodule resolves to a namespace that has a different name from its path 2015-06-23 05:49:19 -07:00
tab_helper_spec.rb Fix Style/SpaceInsideHashLiteralBraces cop violations 2015-06-22 14:41:00 -04:00
tree_helper_spec.rb Fix bad multi-line split from previous commit 2015-06-22 16:06:04 -04:00
visibility_level_helper_spec.rb Fork visibility level fix 2015-07-06 17:40:33 +03:00