oliverguenther / openproject-revisions_git

An OpenProject plugin for managing Git repositories through Gitolite.
MIT License
13 stars 4 forks source link

New (empty) repository not shown properly #19

Closed eudoxos closed 9 years ago

eudoxos commented 9 years ago

After I create a new repository (which is created in gitolite on the server) and then click to display it, OP says:

404
[bug] The entry or revision was not found in the repository.
Back

(and repository access links on the left are not shown either).

The log says just

fatal: bad default revision 'HEAD'
fatal: Not a valid object name HEAD:

When I push first changeset to the repo, the problem disappears completely by itself.

(BTW any way to force timestamps in logs? I asked on the OP forum to no avail...)

oliverguenther commented 9 years ago

I think this matches the internal processing of OpenProject (The plugin does not change that implementation detail).

It finds an empty / bare Git repository and tries to read the current HEAD, which does not (yet) exist. The problem I see is that in this case, the clone URLs aren't displayed.

Would 1c721ab be an acceptable solution?

eudoxos commented 9 years ago

I am getting an internal error (after the update), this is the log (populated repositories work fine, just the one which is empty produces internal error where it used to give 404 as reported originally):

Started GET "/projects/jam-packed-2014/repository" for 78.108.102.144 at 2015-01-26 21:41:42 +0100
Processing by RepositoriesController#show as HTML
  Parameters: {"project_id"=>"jam-packed-2014"}
  Rendered repositories/_navigation.html.erb (37.4ms)
  Rendered repositories/_breadcrumbs.html.erb (2.6ms)
  Rendered vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/bundler/gems/openproject-revisions_git-1c721ab8d565/app/views/common/_git_urls.html.erb (28.1ms)
  Rendered vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/bundler/gems/openproject-revisions_git-1c721ab8d565/app/views/repositories/show.html.erb within layouts/base (136.8ms)
Completed 500 Internal Server Error in 467.5ms

ActionView::Template::Error (undefined method `[]' for nil:NilClass):
    1: <% if !repository.available_urls.empty? %>
    2:   <div id="git_url_box">
    3:     <ul id="git_url_list">
    4:       <% repository.available_urls.each do |key, value| %>
  vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/bundler/gems/openproject-revisions_git-1c721ab8d565/lib/open_project/revisions/git/patches/repository_git_patch.rb:105:in `available_urls'
  vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/bundler/gems/openproject-revisions_git-1c721ab8d565/app/views/common/_git_urls.html.erb:1:in `_vendor_ruby_______lib_ruby_gems_______bundler_gems_openproject_revisions_git__c___ab_d____app_views_common__git_urls_html_erb__445575560736782678_70330383213180'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/template.rb:145:in `block in render'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications.rb:125:in `instrument'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/template.rb:143:in `render'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `block in instrument'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `instrument'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:237:in `render'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:41:in `render_partial'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:15:in `render'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/helpers/rendering_helper.rb:24:in `render'
  vendor/bundle/ruby/2.1.0/gems/prototype-rails-3.2.1/lib/prototype-rails/rendering.rb:8:in `render_with_update'
  vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/bundler/gems/openproject-revisions_git-1c721ab8d565/app/views/repositories/show.html.erb:73:in `block in _vendor_ruby_______lib_ruby_gems_______bundler_gems_openproject_revisions_git__c___ab_d____app_views_repositories_show_html_erb__1700560903007874533_70330381420800'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:40:in `capture'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:138:in `content_for'
  vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/bundler/gems/openproject-revisions_git-1c721ab8d565/app/views/repositories/show.html.erb:69:in `_vendor_ruby_______lib_ruby_gems_______bundler_gems_openproject_revisions_git__c___ab_d____app_views_repositories_show_html_erb__1700560903007874533_70330381420800'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/template.rb:145:in `block in render'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications.rb:125:in `instrument'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/template.rb:143:in `render'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `block in instrument'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `instrument'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:45:in `render_template'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:18:in `render'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:36:in `render_template'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:17:in `render'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:110:in `_render_template'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/streaming.rb:225:in `_render_template'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:103:in `render_to_body'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:88:in `render'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/rendering.rb:16:in `render'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
  vendor/ruby-2.1.4/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/core_ext/benchmark.rb:5:in `ms'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
  vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.21/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:39:in `render'
  vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/bundler/gems/openproject-revisions_git-1c721ab8d565/lib/open_project/revisions/git/patches/repositories_controller_patch.rb:27:in `show_with_revisions_git'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/abstract_controller/base.rb:167:in `process_action'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/rendering.rb:10:in `process_action'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:524:in `_run__2957457054183408073__process_action__3006065301463255364__callbacks'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in `__run_callback'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:81:in `run_callbacks'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/abstract_controller/callbacks.rb:17:in `process_action'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/rescue.rb:29:in `process_action'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `block in instrument'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `instrument'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.21/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/abstract_controller/base.rb:121:in `process'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:45:in `process'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal.rb:203:in `dispatch'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_controller/metal.rb:246:in `block in action'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:73:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:36:in `call'
  vendor/bundle/ruby/2.1.0/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
  vendor/bundle/ruby/2.1.0/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
  vendor/bundle/ruby/2.1.0/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:608:in `call'
  vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/omniauth-1.2.2/lib/omniauth/builder.rb:59:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/head.rb:14:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/flash.rb:242:in `call'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/cookies.rb:341:in `call'
  vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.21/lib/active_record/query_cache.rb:64:in `call'
  vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in `_run__2831614709363250529__call__128686098664709848__callbacks'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in `__run_callback'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:81:in `run_callbacks'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  vendor/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/rack/logger.rb:32:in `call_app'
  vendor/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/rack/logger.rb:16:in `block in call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/tagged_logging.rb:22:in `tagged'
  vendor/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/rack/logger.rb:16:in `call'
  vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/request_store-1.1.0/lib/request_store/middleware.rb:8:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/request_id.rb:22:in `call'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
  vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/static.rb:83:in `call'
  vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
  vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
  vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
  vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
  vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
  vendor/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/engine.rb:484:in `call'
  vendor/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:231:in `call'
  vendor/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in `method_missing'
  vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/bundler/gems/rack-protection-5a7d1bd2f05c/lib/rack/protection/frame_options.rb:31:in `call'
  vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/bundler/gems/rack-protection-5a7d1bd2f05c/lib/rack/protection/json_csrf.rb:18:in `call'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in `block in call'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `each'
  vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `call'
  vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:576:in `process_client'
  vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:670:in `worker_loop'
  vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
  vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:140:in `start'
  vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>'
  vendor/bundle/bin/unicorn:16:in `load'
  vendor/bundle/bin/unicorn:16:in `<main>'
oliverguenther commented 9 years ago

This is related to #16. Though I can't reproduce that error, I have now merged the fix by JohnDoe42. Does that fix your error, as well?

eudoxos commented 9 years ago

Still the same here (I hope 1e8c6c58e7cb is the last revision):

ActionView::Template::Error (undefined method `[]' for nil:NilClass):
   1: <% if !repository.available_urls.empty? %>
   2:   <div id="git_url_box">
   3:     <ul id="git_url_list">
   4:       <% repository.available_urls.each do |key, value| %>
 vendor/ruby-2.1.4/lib/ruby/gems/2.1.0/bundler/gems/openproject-revisions_git-1e8c6c58e7cb/lib/open_project/revisions/git/patches/repository_git_patch.rb:105:in `available_urls'
oliverguenther commented 9 years ago

Ah, I see. The error seems to stem from an empty GitRepositoryExtras. Okay, I'll have to look into why that extra model is not attached to the repository instance. If that's really the case, the error should be fixed with d5c0cbb

eudoxos commented 9 years ago

That fixed it, thanks!