New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`TypeError (no implicit conversion of nil into Array)` when creating a new project with auto repo init turned on #336

Closed
necramirez opened this Issue Jan 28, 2015 · 35 comments

Comments

Projects
None yet
2 participants
@necramirez

necramirez commented Jan 28, 2015

  • Ruby: 2.0.0-p598
  • Redmine: 2.6.0.stable
  • Git: 1.7.1
  • redmine_git_hosting: v1.x branch

I have Automatically initialize Git repositories for new projects turned on, and I create a new project. I get this error in Redmine's production.log:

Started GET "/projects/new" for 9.187.62.249 at 2015-01-28 02:37:24 -0500
Processing by ProjectsController#new as HTML
  Current user: admin (id=1)
  Rendered projects/_form.html.erb (17.1ms)
  Rendered projects/new.html.erb within layouts/base (20.7ms)
Completed 200 OK in 50.6ms (Views: 36.2ms | ActiveRecord: 3.0ms)
Started POST "/projects" for 9.187.62.249 at 2015-01-28 02:37:41 -0500
Processing by ProjectsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"QUH8EX6l/0QCuL1j0jnR/tllhwGlnOrBMedkFJf4tJM=", "project"=>{"name"=>"Team Page", "description"=>"", "identifier"=>"team-page", "homepage"=>"", "is_public"=>"1", "parent_id"=>"", "inherit_members"=>"0", "enabled_module_names"=>["issue_tracking", "time_tracking", "files", "wiki", "repository", ""], "tracker_ids"=>["1", "2", ""], "issue_custom_field_ids"=>[""]}, "commit"=>"Create"}
  Current user: admin (id=1)
Redirected to http://localhost/projects/team-page/settings
Completed 500 Internal Server Error in 1420.5ms

TypeError (no implicit conversion of nil into Array):
  lib/redmine/scm/adapters/git_adapter.rb:85:in `branches'
  app/models/repository/git.rb:75:in `branches'
  app/models/repository/git.rb:130:in `fetch_changesets'

NOTE: This also happens when Automatically initialize Git repositories for new projects is turned off, then I create the project, then try to create the repository.

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 28, 2015

I checked ~git/repositories/ and the repository was still created.

I can still go to the project's Settings -> Repositories without any error. However, when I try to Edit the repository, I see this error in the Redmine logs:

Started GET "/repositories/19/edit" for 9.187.68.222 at 2015-01-28 03:48:45 -0500
Processing by RepositoriesController#edit as HTML
  Parameters: {"id"=>"19"}
  Current user: admin (id=1)
  Rendered plugins/redmine_git_hosting/app/views/common/_git_urls.html.erb (6.3ms)
  Rendered plugins/redmine_git_hosting/app/views/repositories/_edit_top.html.haml (6.7ms)
  Rendered repositories/_form.html.erb (2.8ms)
  Rendered plugins/redmine_git_hosting/app/views/repositories/_xitolite_options.html.haml (4.2ms)
  Rendered plugins/redmine_git_hosting/app/views/repositories/edit.html.haml within layouts/base (16.5ms)
Completed 500 Internal Server Error in 24.6ms

ActionView::Template::Error (no implicit conversion of nil into Array):
    35: 
    36:               %p
    37:                 = label_tag 'repository_git_extra[default_branch]', l(:label_repository_default_branch)
    38:                 - if !repository.branches.empty?
    39:                   = f.select :default_branch, repository_branches_list(repository.branches)
    40:                 - else
    41:                   %span{ class: 'label label-info' }= repository.default_branch
  lib/redmine/scm/adapters/git_adapter.rb:85:in `branches'
  app/models/repository/git.rb:75:in `branches'

There is also an error when I try to view that repo.

necramirez commented Jan 28, 2015

I checked ~git/repositories/ and the repository was still created.

I can still go to the project's Settings -> Repositories without any error. However, when I try to Edit the repository, I see this error in the Redmine logs:

Started GET "/repositories/19/edit" for 9.187.68.222 at 2015-01-28 03:48:45 -0500
Processing by RepositoriesController#edit as HTML
  Parameters: {"id"=>"19"}
  Current user: admin (id=1)
  Rendered plugins/redmine_git_hosting/app/views/common/_git_urls.html.erb (6.3ms)
  Rendered plugins/redmine_git_hosting/app/views/repositories/_edit_top.html.haml (6.7ms)
  Rendered repositories/_form.html.erb (2.8ms)
  Rendered plugins/redmine_git_hosting/app/views/repositories/_xitolite_options.html.haml (4.2ms)
  Rendered plugins/redmine_git_hosting/app/views/repositories/edit.html.haml within layouts/base (16.5ms)
Completed 500 Internal Server Error in 24.6ms

ActionView::Template::Error (no implicit conversion of nil into Array):
    35: 
    36:               %p
    37:                 = label_tag 'repository_git_extra[default_branch]', l(:label_repository_default_branch)
    38:                 - if !repository.branches.empty?
    39:                   = f.select :default_branch, repository_branches_list(repository.branches)
    40:                 - else
    41:                   %span{ class: 'label label-info' }= repository.default_branch
  lib/redmine/scm/adapters/git_adapter.rb:85:in `branches'
  app/models/repository/git.rb:75:in `branches'

There is also an error when I try to view that repo.

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 28, 2015

Here's what I see in git_hosting.log, when I create the repository with Initialize this repository with a README unchecked:

2015-01-28 04:08:51 -0500 [INFO] User 'admin' created a new repository 'team-page'
2015-01-28 04:08:51 -0500 [INFO] Accessing gitolite-admin.git at '/tmp/redmine_git_hosting/git/gitolite-admin.git'
2015-01-28 04:08:51 -0500 [INFO] add_repository : repository 'team-page' does not exist in Gitolite, create it ...
2015-01-28 04:08:51 -0500 [DEBUG] add_repository : repository path 'repositories/team-page.git'
2015-01-28 04:08:51 -0500 [INFO] add_repository : commiting to Gitolite...
2015-01-28 04:08:51 -0500 [DEBUG] Non-zero exit code pid 8605 exit 1 for `sudo -n -u git -i find /home/git/recycle_bin/ -type d -regex /home/git/recycle_bin/[0-9]+__team-page.git -prune -print`
2015-01-28 04:08:51 -0500 [INFO] add_repository : let Gitolite create empty repository 'repositories/team-page.git'
2015-01-28 04:08:52 -0500 [INFO] Execute Gitolite Plugins

And here's the log when it's checked:

2015-01-28 04:11:47 -0500 [INFO] User 'admin' created a new repository 'team-page'
2015-01-28 04:11:47 -0500 [INFO] Accessing gitolite-admin.git at '/tmp/redmine_git_hosting/git/gitolite-admin.git'
2015-01-28 04:11:48 -0500 [INFO] add_repository : repository 'team-page' does not exist in Gitolite, create it ...
2015-01-28 04:11:48 -0500 [DEBUG] add_repository : repository path 'repositories/team-page.git'
2015-01-28 04:11:48 -0500 [INFO] add_repository : commiting to Gitolite...
2015-01-28 04:11:48 -0500 [DEBUG] Non-zero exit code pid 12282 exit 1 for `sudo -n -u git -i find /home/git/recycle_bin/ -type d -regex /home/git/recycle_bin/[0-9]+__team-page.git -prune -print`
2015-01-28 04:11:48 -0500 [INFO] add_repository : let Gitolite create empty repository 'repositories/team-page.git'
2015-01-28 04:11:48 -0500 [INFO] Execute Gitolite Plugins
2015-01-28 04:11:49 -0500 [INFO] Create README file for repository 'team-page'
2015-01-28 04:11:49 -0500 [ERROR] Error while creating README file for repository 'team-page'
2015-01-28 04:11:49 -0500 [ERROR] Early EOF

necramirez commented Jan 28, 2015

Here's what I see in git_hosting.log, when I create the repository with Initialize this repository with a README unchecked:

2015-01-28 04:08:51 -0500 [INFO] User 'admin' created a new repository 'team-page'
2015-01-28 04:08:51 -0500 [INFO] Accessing gitolite-admin.git at '/tmp/redmine_git_hosting/git/gitolite-admin.git'
2015-01-28 04:08:51 -0500 [INFO] add_repository : repository 'team-page' does not exist in Gitolite, create it ...
2015-01-28 04:08:51 -0500 [DEBUG] add_repository : repository path 'repositories/team-page.git'
2015-01-28 04:08:51 -0500 [INFO] add_repository : commiting to Gitolite...
2015-01-28 04:08:51 -0500 [DEBUG] Non-zero exit code pid 8605 exit 1 for `sudo -n -u git -i find /home/git/recycle_bin/ -type d -regex /home/git/recycle_bin/[0-9]+__team-page.git -prune -print`
2015-01-28 04:08:51 -0500 [INFO] add_repository : let Gitolite create empty repository 'repositories/team-page.git'
2015-01-28 04:08:52 -0500 [INFO] Execute Gitolite Plugins

And here's the log when it's checked:

2015-01-28 04:11:47 -0500 [INFO] User 'admin' created a new repository 'team-page'
2015-01-28 04:11:47 -0500 [INFO] Accessing gitolite-admin.git at '/tmp/redmine_git_hosting/git/gitolite-admin.git'
2015-01-28 04:11:48 -0500 [INFO] add_repository : repository 'team-page' does not exist in Gitolite, create it ...
2015-01-28 04:11:48 -0500 [DEBUG] add_repository : repository path 'repositories/team-page.git'
2015-01-28 04:11:48 -0500 [INFO] add_repository : commiting to Gitolite...
2015-01-28 04:11:48 -0500 [DEBUG] Non-zero exit code pid 12282 exit 1 for `sudo -n -u git -i find /home/git/recycle_bin/ -type d -regex /home/git/recycle_bin/[0-9]+__team-page.git -prune -print`
2015-01-28 04:11:48 -0500 [INFO] add_repository : let Gitolite create empty repository 'repositories/team-page.git'
2015-01-28 04:11:48 -0500 [INFO] Execute Gitolite Plugins
2015-01-28 04:11:49 -0500 [INFO] Create README file for repository 'team-page'
2015-01-28 04:11:49 -0500 [ERROR] Error while creating README file for repository 'team-page'
2015-01-28 04:11:49 -0500 [ERROR] Early EOF
@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 28, 2015

I also tried to manually fetch changesets using the rake task:

[redmine@xxx redmine]$ bundle exec rake redmine_git_hosting:fetch_changesets RAILS_ENV=production --trace
** Invoke redmine_git_hosting:fetch_changesets (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine_git_hosting:fetch_changesets
Performing manual fetch_changesets operation...
rake aborted!
TypeError: no implicit conversion of nil into Array
/home/redmine/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/xitolite_adapter_patch.rb:195:in `concat'
/home/redmine/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/xitolite_adapter_patch.rb:195:in `base_args'
/home/redmine/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/xitolite_adapter_patch.rb:174:in `prepare_command'
/home/redmine/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/xitolite_adapter_patch.rb:161:in `git_cmd_with_git_hosting'
/home/redmine/redmine/lib/redmine/scm/adapters/git_adapter.rb:85:in `branches'
/home/redmine/redmine/app/models/repository/git.rb:75:in `branches'
/home/redmine/redmine/app/models/repository/git.rb:130:in `fetch_changesets'
/home/redmine/redmine/app/models/repository.rb:342:in `block (2 levels) in fetch_changesets'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/activerecord-3.2.19/lib/active_record/associations/collection_proxy.rb:91:in `each'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/activerecord-3.2.19/lib/active_record/associations/collection_proxy.rb:91:in `method_missing'
/home/redmine/redmine/app/models/repository.rb:340:in `block in fetch_changesets'
/home/redmine/redmine/app/models/repository.rb:339:in `each'
/home/redmine/redmine/app/models/repository.rb:339:in `fetch_changesets'
/home/redmine/redmine/plugins/redmine_git_hosting/lib/tasks/redmine_git_hosting.rake:35:in `block (2 levels) in <top (required)>'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/redmine/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/bin/rake:23:in `load'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/bin/rake:23:in `<main>'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/bin/ruby_executable_hooks:15:in `eval'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => redmine_git_hosting:fetch_changesets

necramirez commented Jan 28, 2015

I also tried to manually fetch changesets using the rake task:

[redmine@xxx redmine]$ bundle exec rake redmine_git_hosting:fetch_changesets RAILS_ENV=production --trace
** Invoke redmine_git_hosting:fetch_changesets (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine_git_hosting:fetch_changesets
Performing manual fetch_changesets operation...
rake aborted!
TypeError: no implicit conversion of nil into Array
/home/redmine/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/xitolite_adapter_patch.rb:195:in `concat'
/home/redmine/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/xitolite_adapter_patch.rb:195:in `base_args'
/home/redmine/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/xitolite_adapter_patch.rb:174:in `prepare_command'
/home/redmine/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/xitolite_adapter_patch.rb:161:in `git_cmd_with_git_hosting'
/home/redmine/redmine/lib/redmine/scm/adapters/git_adapter.rb:85:in `branches'
/home/redmine/redmine/app/models/repository/git.rb:75:in `branches'
/home/redmine/redmine/app/models/repository/git.rb:130:in `fetch_changesets'
/home/redmine/redmine/app/models/repository.rb:342:in `block (2 levels) in fetch_changesets'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/activerecord-3.2.19/lib/active_record/associations/collection_proxy.rb:91:in `each'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/activerecord-3.2.19/lib/active_record/associations/collection_proxy.rb:91:in `method_missing'
/home/redmine/redmine/app/models/repository.rb:340:in `block in fetch_changesets'
/home/redmine/redmine/app/models/repository.rb:339:in `each'
/home/redmine/redmine/app/models/repository.rb:339:in `fetch_changesets'
/home/redmine/redmine/plugins/redmine_git_hosting/lib/tasks/redmine_git_hosting.rake:35:in `block (2 levels) in <top (required)>'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/redmine/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/bin/rake:23:in `load'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/bin/rake:23:in `<main>'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/bin/ruby_executable_hooks:15:in `eval'
/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => redmine_git_hosting:fetch_changesets

@n-rodriguez n-rodriguez self-assigned this Jan 29, 2015

@n-rodriguez n-rodriguez added the bug label Jan 29, 2015

@n-rodriguez n-rodriguez added this to the 1.0.1 milestone Jan 29, 2015

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

Actually there are 2 bugs here :

first one : README file is not created :

2015-01-28 04:11:49 -0500 [INFO] Create README file for repository 'team-page'
2015-01-28 04:11:49 -0500 [ERROR] Error while creating README file for repository 'team-page'

Solution : https://jbox-web.github.io/redmine_git_hosting/configuration/troubleshooting/#initialization-of-the-repo-with-readme-file-does-not-work

second :

ActionView::Template::Error (no implicit conversion of nil into Array):
    35: 
    36:               %p
    37:                 = label_tag 'repository_git_extra[default_branch]', l(:label_repository_default_branch)
    38:                 - if !repository.branches.empty?
    39:                   = f.select :default_branch, repository_branches_list(repository.branches)
    40:                 - else
    41:                   %span{ class: 'label label-info' }= repository.default_branch
  lib/redmine/scm/adapters/git_adapter.rb:85:in `branches'
  app/models/repository/git.rb:75:in `branches'

The repository is empty : no branches here. (I should test for nil before)

Member

n-rodriguez commented Jan 29, 2015

Actually there are 2 bugs here :

first one : README file is not created :

2015-01-28 04:11:49 -0500 [INFO] Create README file for repository 'team-page'
2015-01-28 04:11:49 -0500 [ERROR] Error while creating README file for repository 'team-page'

Solution : https://jbox-web.github.io/redmine_git_hosting/configuration/troubleshooting/#initialization-of-the-repo-with-readme-file-does-not-work

second :

ActionView::Template::Error (no implicit conversion of nil into Array):
    35: 
    36:               %p
    37:                 = label_tag 'repository_git_extra[default_branch]', l(:label_repository_default_branch)
    38:                 - if !repository.branches.empty?
    39:                   = f.select :default_branch, repository_branches_list(repository.branches)
    40:                 - else
    41:                   %span{ class: 'label label-info' }= repository.default_branch
  lib/redmine/scm/adapters/git_adapter.rb:85:in `branches'
  app/models/repository/git.rb:75:in `branches'

The repository is empty : no branches here. (I should test for nil before)

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 29, 2015

Ok, so the first one is a different bug altogether. Let me open a new issue for that: #338

necramirez commented Jan 29, 2015

Ok, so the first one is a different bug altogether. Let me open a new issue for that: #338

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 29, 2015

The second one, I traced a bit and found that the command to get branches didn't get anything. I pushed something, so master now exists in that repo, but I still get the error.

Then I stumbled upon you Development Guide (https://jbox-web.github.io/redmine_git_hosting/guide/development/) and saw that you had Git 1.9.1, while I only had 1.7.1

I then upgraded my Git, and it now works! This means that redmine_git_hosting needs a minimum Git version that's higher than 1.7.1 -- which isn't stated anywhere in the docs.

necramirez commented Jan 29, 2015

The second one, I traced a bit and found that the command to get branches didn't get anything. I pushed something, so master now exists in that repo, but I still get the error.

Then I stumbled upon you Development Guide (https://jbox-web.github.io/redmine_git_hosting/guide/development/) and saw that you had Git 1.9.1, while I only had 1.7.1

I then upgraded my Git, and it now works! This means that redmine_git_hosting needs a minimum Git version that's higher than 1.7.1 -- which isn't stated anywhere in the docs.

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

Thank you!

Member

n-rodriguez commented Jan 29, 2015

Thank you!

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 29, 2015

I guess we can close this now, since the nil case won't happen with the correct Git version, right? The empty repo page should show up?

necramirez commented Jan 29, 2015

I guess we can close this now, since the nil case won't happen with the correct Git version, right? The empty repo page should show up?

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

I guess we can close this now, since the nil case won't happen with the correct Git version, right?

Yes, but I need to be sure.

The empty repo page should show up?

Yes

Member

n-rodriguez commented Jan 29, 2015

I guess we can close this now, since the nil case won't happen with the correct Git version, right?

Yes, but I need to be sure.

The empty repo page should show up?

Yes

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

Btw I've just added a warning in Config Check for Git version < 1.8.5 : ec11e79

Member

n-rodriguez commented Jan 29, 2015

Btw I've just added a warning in Config Check for Git version < 1.8.5 : ec11e79

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

Fixed in Redmine trunk : http://www.redmine.org/projects/redmine/repository/revisions/13927/diff/trunk/lib/redmine/scm/adapters/git_adapter.rb but maybe I should monkey patch this method to avoid nil...

Member

n-rodriguez commented Jan 29, 2015

Fixed in Redmine trunk : http://www.redmine.org/projects/redmine/repository/revisions/13927/diff/trunk/lib/redmine/scm/adapters/git_adapter.rb but maybe I should monkey patch this method to avoid nil...

n-rodriguez added a commit that referenced this issue Jan 29, 2015

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

Can you please test with the monkey-patch-branch?

Member

n-rodriguez commented Jan 29, 2015

Can you please test with the monkey-patch-branch?

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

A very good point for you!! It does need a quiet recent version of Git, I forgot this point.
Actually it needs a Git version that provides the -C argument.

I think I should go to bed... It's not that... We don't use the -C argument but --git-dir (https://github.com/jbox-web/redmine_git_hosting/blob/devel/lib/redmine_git_hosting/commands/git.rb#L101). (I use the -C on another project which also uses Git repositories but nothing to do with Redmine Git Hosting...)

Member

n-rodriguez commented Jan 29, 2015

A very good point for you!! It does need a quiet recent version of Git, I forgot this point.
Actually it needs a Git version that provides the -C argument.

I think I should go to bed... It's not that... We don't use the -C argument but --git-dir (https://github.com/jbox-web/redmine_git_hosting/blob/devel/lib/redmine_git_hosting/commands/git.rb#L101). (I use the -C on another project which also uses Git repositories but nothing to do with Redmine Git Hosting...)

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 29, 2015

  1. delete my repo
  2. clear recycle bin
  3. create new repo, DID NOT auto init with README -- repo is created in gitolite side
  4. I go to project's Repository tab, but get a 404
The entry or revision was not found in the repository.

I tried to Resync all projects and Flush Git cache, but I still get the 404, not the empty repo page.

I pushed from my local, so master is now in gitolite, and the repo page now gives a 500 error. production.log says:

Started GET "/projects/team-page/repository" for 9.187.68.222 at 2015-01-28 23:12:53 -0500
Processing by RepositoriesController#show as HTML
  Parameters: {"id"=>"team-page"}
  Current user: admin (id=1)
SCM command failed, make sure that your SCM command (e.g. svn) is in PATH (/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/bin:/home/redmine/.rvm/gems/ruby-2.0.0-p598@global/bin:/home/redmine/.rvm/rubies/ruby-2.0.0-p598/bin:/usr/lib64/qt-3.3/bin:/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/home/redmine/.rvm/bin:/home/redmine/bin)
You can configure your scm commands in config/configuration.yml.
'sudo' '-n' '-u' 'git' '-i' 'git' '--git-dir' 'repositories/team-page.git' '-c' 'core.quotepath=false' '-c' 'log.decorate=no' 'branch' '--no-color' '--verbose' '--no-abbrev'
with: uninitialized constant RedmineGitHosting::Patches::XitoliteAdapterPatch::InstanceMethods::GitBranch
Completed 500 Internal Server Error in 153.7ms

NameError (uninitialized constant RedmineGitHosting::Patches::XitoliteAdapterPatch::InstanceMethods::ScmCommandAborted):
  app/models/repository/git.rb:75:in `branches'
  app/controllers/repositories_controller.rb:326:in `find_project_repository'

To address SCM command failed, I explicitly specified in <redmine root>/config/configuration.yml:

  scm_git_command: /usr/bin/git

to no avail.

necramirez commented Jan 29, 2015

  1. delete my repo
  2. clear recycle bin
  3. create new repo, DID NOT auto init with README -- repo is created in gitolite side
  4. I go to project's Repository tab, but get a 404
The entry or revision was not found in the repository.

I tried to Resync all projects and Flush Git cache, but I still get the 404, not the empty repo page.

I pushed from my local, so master is now in gitolite, and the repo page now gives a 500 error. production.log says:

Started GET "/projects/team-page/repository" for 9.187.68.222 at 2015-01-28 23:12:53 -0500
Processing by RepositoriesController#show as HTML
  Parameters: {"id"=>"team-page"}
  Current user: admin (id=1)
SCM command failed, make sure that your SCM command (e.g. svn) is in PATH (/home/redmine/.rvm/gems/ruby-2.0.0-p598@redmine-2.3/bin:/home/redmine/.rvm/gems/ruby-2.0.0-p598@global/bin:/home/redmine/.rvm/rubies/ruby-2.0.0-p598/bin:/usr/lib64/qt-3.3/bin:/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/home/redmine/.rvm/bin:/home/redmine/bin)
You can configure your scm commands in config/configuration.yml.
'sudo' '-n' '-u' 'git' '-i' 'git' '--git-dir' 'repositories/team-page.git' '-c' 'core.quotepath=false' '-c' 'log.decorate=no' 'branch' '--no-color' '--verbose' '--no-abbrev'
with: uninitialized constant RedmineGitHosting::Patches::XitoliteAdapterPatch::InstanceMethods::GitBranch
Completed 500 Internal Server Error in 153.7ms

NameError (uninitialized constant RedmineGitHosting::Patches::XitoliteAdapterPatch::InstanceMethods::ScmCommandAborted):
  app/models/repository/git.rb:75:in `branches'
  app/controllers/repositories_controller.rb:326:in `find_project_repository'

To address SCM command failed, I explicitly specified in <redmine root>/config/configuration.yml:

  scm_git_command: /usr/bin/git

to no avail.

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

I pushed from my local, so master is now in gitolite, and the repo page now gives a 500 error. production.log says:

Actually it's worse than that... I don't completly understand the Ruby inheritance mechanism...
XitoliteAdapter inherits from GitAdapter but some classes which are define directly in GitAdapter are not inherited (GitBranch, ScmCommandAborted and maybe others) hence the NameError exception.

To fix this I had to reimplement the whole GitAdapter class in XitoliteAdapter... I wanted to avoid that to avoid code duplication but it seems to be the only way...

This has revealed an other issue in RepositoryController with the find_project_repository method wich render 404 error if no branch are found. I've monkey patched the method to render Git instructions.

Now it works with Git 1.7.10 :)

Member

n-rodriguez commented Jan 29, 2015

I pushed from my local, so master is now in gitolite, and the repo page now gives a 500 error. production.log says:

Actually it's worse than that... I don't completly understand the Ruby inheritance mechanism...
XitoliteAdapter inherits from GitAdapter but some classes which are define directly in GitAdapter are not inherited (GitBranch, ScmCommandAborted and maybe others) hence the NameError exception.

To fix this I had to reimplement the whole GitAdapter class in XitoliteAdapter... I wanted to avoid that to avoid code duplication but it seems to be the only way...

This has revealed an other issue in RepositoryController with the find_project_repository method wich render 404 error if no branch are found. I've monkey patched the method to render Git instructions.

Now it works with Git 1.7.10 :)

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 29, 2015

Which branch should I test now? :)

necramirez commented Jan 29, 2015

Which branch should I test now? :)

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

You can do a git pull on monkey-patch-branch

Member

n-rodriguez commented Jan 29, 2015

You can do a git pull on monkey-patch-branch

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

I then upgraded my Git, and it now works! This means that redmine_git_hosting needs a minimum Git version that's higher than 1.7.1 -- which isn't stated anywhere in the docs.

I've reverted the doc but it was already here : https://jbox-web.github.io/redmine_git_hosting/download/index.html ;)

Member

n-rodriguez commented Jan 29, 2015

I then upgraded my Git, and it now works! This means that redmine_git_hosting needs a minimum Git version that's higher than 1.7.1 -- which isn't stated anywhere in the docs.

I've reverted the doc but it was already here : https://jbox-web.github.io/redmine_git_hosting/download/index.html ;)

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 29, 2015

Both the 404 and 500 are gone! However, I still see the empty repo page, despite having pushed master already. I had to do a manual bundle exec rake redmine_git_hosting:fetch_changesets RAILS_ENV=production --trace before the code appeared in the repo page. This despite having cache disabled for redmine_git_hosting.

necramirez commented Jan 29, 2015

Both the 404 and 500 are gone! However, I still see the empty repo page, despite having pushed master already. I had to do a manual bundle exec rake redmine_git_hosting:fetch_changesets RAILS_ENV=production --trace before the code appeared in the repo page. This despite having cache disabled for redmine_git_hosting.

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

Check your Hook url in plugin settings

Member

n-rodriguez commented Jan 29, 2015

Check your Hook url in plugin settings

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

I've merged the patch in devel and v1.x branches so you can switch back to v1.x

Member

n-rodriguez commented Jan 29, 2015

I've merged the patch in devel and v1.x branches so you can switch back to v1.x

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 29, 2015

What value should I assign to Hooks URL?

I have mine as the Redmine root URL, with https:// (e.g. https://my.server.com ). The Hooks tab now shows Hooks URL as https://my.server.com/githooks/post-receive/redmine and Hooks Git namespace as redminegitolite

necramirez commented Jan 29, 2015

What value should I assign to Hooks URL?

I have mine as the Redmine root URL, with https:// (e.g. https://my.server.com ). The Hooks tab now shows Hooks URL as https://my.server.com/githooks/post-receive/redmine and Hooks Git namespace as redminegitolite

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

I have mine as the Redmine root URL, with https:// (e.g. https://my.server.com ). The Hooks tab now shows Hooks URL as https://my.server.com/githooks/post-receive/redmine and Hooks Git namespace as redminegitolite

That should be fine.

Member

n-rodriguez commented Jan 29, 2015

I have mine as the Redmine root URL, with https:// (e.g. https://my.server.com ). The Hooks tab now shows Hooks URL as https://my.server.com/githooks/post-receive/redmine and Hooks Git namespace as redminegitolite

That should be fine.

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 29, 2015

Will there be any issues with an untrusted SSL cert/CA for HTTPS Hooks URLs (we have a company-internal CA)?

necramirez commented Jan 29, 2015

Will there be any issues with an untrusted SSL cert/CA for HTTPS Hooks URLs (we have a company-internal CA)?

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 29, 2015

My Hooks URL isn't being hit at all, looking at ~git/.gitolite/logs/gitolite-*.log..

necramirez commented Jan 29, 2015

My Hooks URL isn't being hit at all, looking at ~git/.gitolite/logs/gitolite-*.log..

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 29, 2015

Member

My Hooks URL isn't being hit at all, looking at ~git/.gitolite/logs/gitolite-*.log..

You won't see it here but in <redmine root>/log/git_hosting.log.

Member

n-rodriguez commented Jan 29, 2015

My Hooks URL isn't being hit at all, looking at ~git/.gitolite/logs/gitolite-*.log..

You won't see it here but in <redmine root>/log/git_hosting.log.

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 30, 2015

There's also nothing logged in git_hosting.log

necramirez commented Jan 30, 2015

There's also nothing logged in git_hosting.log

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 30, 2015

Just to add, I'm not seeing the Notifying Redmine about changes to this repository message when I push from my local. Looks like the post-update hook really isn't being triggered.

I have Ruby 1.8.7 installed globally on my server, so it's available to the git user:

[git@xxx ~]$ ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]

necramirez commented Jan 30, 2015

Just to add, I'm not seeing the Notifying Redmine about changes to this repository message when I push from my local. Looks like the post-update hook really isn't being triggered.

I have Ruby 1.8.7 installed globally on my server, so it's available to the git user:

[git@xxx ~]$ ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 30, 2015

I've also executed this manually:

gitolite setup --hooks-only

but still, nothing is happening.

What else can I check?

necramirez commented Jan 30, 2015

I've also executed this manually:

gitolite setup --hooks-only

but still, nothing is happening.

What else can I check?

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 30, 2015

I see something new!

The repo isn't updated in Redmine only for the initial push.

  1. Create new project/repo -- repo is empty
  2. I see the empty repo page
  3. I do the initial push from my local
  4. I still see the empty repo page
  5. I manually run the rake task fetch_changesets
  6. Repo page is now updated
  7. I make a new commit and push
  8. Repo page is updated immediately

necramirez commented Jan 30, 2015

I see something new!

The repo isn't updated in Redmine only for the initial push.

  1. Create new project/repo -- repo is empty
  2. I see the empty repo page
  3. I do the initial push from my local
  4. I still see the empty repo page
  5. I manually run the rake task fetch_changesets
  6. Repo page is now updated
  7. I make a new commit and push
  8. Repo page is updated immediately
@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Jan 30, 2015

My current workaround is I added a cron job to run the fetch_changesets rake task every 15 minutes.

Will wait for your feedback.

necramirez commented Jan 30, 2015

My current workaround is I added a cron job to run the fetch_changesets rake task every 15 minutes.

Will wait for your feedback.

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Jan 30, 2015

Member

in <git user home>/.gitolite.rc file be sure to have enabled LOCAL code like this :

LOCAL_CODE  =>  "$ENV{HOME}/local"
Member

n-rodriguez commented Jan 30, 2015

in <git user home>/.gitolite.rc file be sure to have enabled LOCAL code like this :

LOCAL_CODE  =>  "$ENV{HOME}/local"
@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Feb 2, 2015

BTW, that's not in the How To Install page. :-p

I updated my .gitolite.rc with that, but it didn't fix my issue.

necramirez commented Feb 2, 2015

BTW, that's not in the How To Install page. :-p

I updated my .gitolite.rc with that, but it didn't fix my issue.

@n-rodriguez

This comment has been minimized.

Show comment
Hide comment
@n-rodriguez

n-rodriguez Feb 5, 2015

Member

BTW, that's not in the How To Install page. :-p

You're right. I'm gonna update the doc.

Member

n-rodriguez commented Feb 5, 2015

BTW, that's not in the How To Install page. :-p

You're right. I'm gonna update the doc.

@necramirez

This comment has been minimized.

Show comment
Hide comment
@necramirez

necramirez Feb 5, 2015

Anyway, the original issue has already been fixed, so I think we can close this already (oh, it's already closed :-p)? I will create a new issue for this initial push problem I'm experiencing.

necramirez commented Feb 5, 2015

Anyway, the original issue has already been fixed, so I think we can close this already (oh, it's already closed :-p)? I will create a new issue for this initial push problem I'm experiencing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment