500 Internal Server Error - TypeError (can't convert nil into String) when check repo is empty.
Created by: Jazznight
After import by "run bundle exec rake gitlab:import:repos RAILS_ENV=production".
I can login and see all the projects at dashboard page. But I can't explorer a specific repo when i click any project link (Please refer log as below msg).
Started GET "/root/common" for at 2013-05-19 17:52:38 +0800 Processing by ProjectsController#show as HTML Parameters: {"id"=>"root/common"} Completed 500 Internal Server Error in 576ms
TypeError (can't convert nil into String):
lib/gitlab/git/repository.rb:54:in commit' lib/gitlab/git/repository.rb:125:in
has_commits?'
lib/gitlab/git/repository.rb:131:in empty?' app/models/repository.rb:20:in
empty?'
app/models/project.rb:339:in empty_repo?' app/controllers/projects_controller.rb:61:in
block (2 levels) in show'
app/controllers/projects_controller.rb:59:in `show'
PS. I have checked lib/gitlab/git/repository.rb#commit. It's very weird..
def commit(commit_id = nil)
commit = if commit_id
repo.commit(commit_id)
else
repo.commits(root_ref).first <== line 54
end
decorate_commit(commit) if commit
end
I have also change line (54) to : Grit::Repo.new('/gitroot/root/common.git').commit('master').first but I still got the same error at line 54.
I also check this line at rails console, but it work well! 1. RAILS_ENV=production bundle exec rails c 2. Grit::Repo.new('/gitroot/root/common.git').commit('master') => <Grit::Commit "5756bbb95cbb665aed16b3e072d11637ae71656d">