Error 500 on accessing wiki for non-initialized repository
Created by: mpontes
After migrating to 6.6.5 from 6.5, trying to access the Wiki section of a project that had no git repository gives out an error 500 with the following in the logs:
Started GET "/dev/documentation/wikis/home" for 127.0.0.1 at 2014-03-12 17:36:54 +0000
Processing by Projects::WikisController#show as HTML
Parameters: {"project_id"=>"dev/documentation", "id"=>"home"}
Rendered projects/wikis/_new.html.haml (1.0ms)
Rendered projects/wikis/_nav.html.haml (4.3ms)
Rendered projects/wikis/_main_links.html.haml (1.3ms)
Rendered projects/wikis/show.html.haml within layouts/projects (14.5ms)
Completed 500 Internal Server Error in 280ms
ActionView::Template::Error (undefined method `sha' for nil:NilClass):
12: .wiki-holder
13: .wiki
14: = preserve do
15: = render_wiki_content(@wiki)
16:
17: %hr
18:
app/helpers/gitlab_markdown_helper.rb:189:in `current_sha'
app/helpers/gitlab_markdown_helper.rb:170:in `file_exists?'
app/helpers/gitlab_markdown_helper.rb:147:in `relative_file_path'
app/helpers/gitlab_markdown_helper.rb:127:in `rebuild_path'
app/helpers/gitlab_markdown_helper.rb:74:in `block in create_relative_links'
app/helpers/gitlab_markdown_helper.rb:72:in `each'
app/helpers/gitlab_markdown_helper.rb:72:in `create_relative_links'
lib/redcarpet/render/gitlab_html.rb:50:in `preprocess'
app/helpers/gitlab_markdown_helper.rb:52:in `render'
app/helpers/gitlab_markdown_helper.rb:52:in `markdown'
app/helpers/gitlab_markdown_helper.rb:57:in `render_wiki_content'
app/views/projects/wikis/show.html.haml:15:in `block in _app_views_projects_wikis_show_html_haml___4365326317245805645_67726260'
app/views/projects/wikis/show.html.haml:14:in `_app_views_projects_wikis_show_html_haml___4365326317245805645_67726260'
app/controllers/projects/wikis_controller.rb:15:in `show'
app/controllers/application_controller.rb:57:in `set_current_user_for_thread'
Creating a dummy git repo and pushing it to that project in Gitlab fixed it. Wikis on projects without code worked in 6.5.