500 Page when creating issue on an empty repo
Created by: henrytm
Hi there, When I create an issue on an empty repo, I get a 500 error. This is on the "new Issue"-Page. The application.log contains:
Completed 500 Internal Server Error in 54ms
ActionView::Template::Error (undefined method `sha' for nil:NilClass):
1: %div.issue-form-holder
2: %h3.page-title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.iid}"
3: %hr
4: - if @repository.contribution_guide && [email protected]?
5: - contribution_guide_url = project_blob_path(@project, tree_join(@repository.root_ref, @repository.contribution_guide.name))
6: .alert.alert-info.col-sm-10.col-sm-offset-2
7: ="Please review the <strong>#{link_to "guidelines for contribution", contribution_guide_url}</strong> to this repository.".html_safe
app/models/repository.rb:183:in `tree'
app/models/repository.rb:173:in `block in contribution_guide'
app/models/repository.rb:172:in `contribution_guide'
app/views/projects/issues/_form.html.haml:4:in `_app_views_projects_issues__form_html_haml__1894836583809090705_70180652056440'
app/views/projects/issues/new.html.haml:1:in `_app_views_projects_issues_new_html_haml___4124311284017262408_70180651987320'
app/controllers/projects/issues_controller.rb:46:in `new'
app/controllers/application_controller.rb:58:in `set_current_user_for_thread'
I think this is caused, because there are no information about commits and therefore it can not create sha hashes of them. I think you should at least display a message like, please init repo. Kind regards, Henry