Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #6108

Closed
Open
Created Jan 22, 2014 by Administrator@rootOwner

[6.4] 500 error when testing hook on empty repo

Created by: chulkilee

Processing by Projects::HooksController#test as HTML
Parameters: {"project_id"=>"groupname/reponame", "id"=>"1"}
Completed 500 Internal Server Error in 36ms

NoMethodError (undefined method `id' for nil:NilClass):
app/services/git_push_service.rb:62:in `sample_data'
app/contexts/test_hook_context.rb:4:in `execute'
app/controllers/projects/hooks_controller.rb:27:in `test'
app/controllers/application_controller.rb:57:in `set_current_user_for_thread'

The nil error happens because it tries to retrieve last and first commit from the repo, which do not exist. See https://github.com/gitlabhq/gitlabhq/blob/6-4-stable/app/services/git_push_service.rb#L62

Possible solution: disable test hook button when repo is empty

Assignee
Assign to
Time tracking