Defect #29230

NoMethodError in fetch_changesets

Added by Eric Riese almost 4 years ago. Updated almost 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:-
Resolution:Invalid Affected version:2.2.3

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

History

#1 Updated by Eric Riese almost 4 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.

#2 Updated by Eric Riese almost 4 years ago

$ git --version
git version 1.7.10.4

#3 Updated by Holger Just almost 4 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.

#4 Updated by Eric Riese almost 4 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.

#5 Updated by Go MAEDA almost 4 years ago

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

#6 Updated by Eric Riese almost 4 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.

Also available in: Atom PDF