Project

General

Profile

Actions

Defect #29230

closed

NoMethodError in fetch_changesets

Added by Eric Riese over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Wish I knew what changed to cause this, but my installation has been running solidly for over 4 years and I almost never touch it and AFAIK nothing has changed about it recently, but all of the sudden I get this error.

NoMethodError (undefined method `sort' for "heads":String):
  app/models/repository/git.rb:142:in `fetch_changesets'
  app/controllers/sys_controller.rb:67:in `block (2 levels) in fetch_changesets'
  app/controllers/sys_controller.rb:66:in `block in fetch_changesets'
  app/controllers/sys_controller.rb:65:in `each'
  app/controllers/sys_controller.rb:65:in `fetch_changesets'

New changes fail to get processed. Manually doing a git fetch on the local mirror repo works fine.
Environment:
  Redmine version                          2.2.3.stable
  Ruby version                             1.9.3 (x86_64-linux)
  Rails version                            3.2.12
  Environment                              production
  Database adapter                         Mysql2
Redmine plugins:
  redmine_hudson                           2.1.2

Actions #1

Updated by Eric Riese over 5 years ago

I also get

Completed 500 Internal Server Error in 1463ms

NoMethodError (undefined method `sort' for "heads":String):
  app/models/repository/git.rb:142:in `fetch_changesets'
  app/controllers/repositories_controller.rb:114:in `show'

when clicking the Repository link.

Actions #2

Updated by Eric Riese over 5 years ago

$ git --version
git version 1.7.10.4
Actions #3

Updated by Holger Just over 5 years ago

It looks like your database contains invalid data for your repository. While I don;t know how it git into that state, you might be able to fix it.

You can edit your database from a mysql console and clear the extra_info column of the respective repository from the repositories table. After that, you can run fetch_changesets again.

Actions #4

Updated by Eric Riese over 5 years ago

That worked. Thank you very much!

extra_info was blank for whatever reason. Setting it to null worked.

This workaround was all I wanted, so I'm fine if you close this defect.

Actions #5

Updated by Go MAEDA over 5 years ago

  • Category set to SCM
  • Status changed from New to Closed
  • Resolution set to Invalid
Actions #6

Updated by Eric Riese over 5 years ago

Turns out that fix only worked the first time. Now extra_info gets rebuilt the first time after setting it to null, but I get this error the next time fetch_changesets gets called.

ArgumentError (comparison of String with nil failed):
  app/models/repository/git.rb:142:in `sort'
  app/models/repository/git.rb:142:in `fetch_changesets'
  app/controllers/sys_controller.rb:67:in `block (2 levels) in fetch_changesets'
  app/controllers/sys_controller.rb:66:in `block in fetch_changesets'
  app/controllers/sys_controller.rb:65:in `each'
  app/controllers/sys_controller.rb:65:in `fetch_changesets'

I googled it and found this which led me to believe that I had too many branches in my repo. Lo and behold, I wasn't pruning old branches. After doing a git fetch --prune which cleared out 1047 branches, and again nulling out extra_info everything seems to be back in working order.

Actions

Also available in: Atom PDF