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
  • #3803

Closed
Open
Created May 02, 2013 by Administrator@rootOwner

Error 500 when changing branch in file view

Created by: joschi

Since upgrading to GitLab 5.1 the file view generates an internal server error when trying to change the branch.

In the example we have a project project_namespace/project_repo with the branches master and stable. There is a README file in that repository which can be displayed at http://git.example.com/project_namespace/project_repo/blob/master/README.md

When trying to change the branch from master to stable with the combo box on that page, the following errors are being logged:

Started GET "/project_namespace/project_repo/refs/switch?utf8=%E2%9C%93&ref=stable&destination=tree&path=README.md" for 127.0.0.1 at 2013-05-02 11:27:24 +0000
Processing by RefsController#switch as HTML
  Parameters: {"utf8"=>"<E2><9C><93>", "ref"=>"stable", "destination"=>"tree", "path"=>"README.md", "project_id"=>"project_namespace/project_repo"}
Redirected to http://git.example.com/project_namespace/project_repo/tree/stable/README.md
Completed 302 Found in 25ms (ActiveRecord: 0.8ms)
Started GET "/project_namespace/project_repo/tree/stable/README.md" for 127.0.0.1 at 2013-05-02 11:27:24 +0000
Processing by TreeController#show as HTML
  Parameters: {"project_id"=>"project_namespace/project_repo", "id"=>"stable/README.md"}
  Rendered shared/_ref_switcher.html.haml (1.5ms)
  Rendered tree/_tree.html.haml (1.9ms)
  Rendered tree/show.html.haml within layouts/project_resource (3.9ms)
Completed 500 Internal Server Error in 35ms

ActionView::Template::Error (undefined method `contents' for #<Grit::Blob "3f879985ffe90e8dfcd5637ae358035b6f54e2d2">):
    37:         %td
    38:         %td
    39: 
    40:     = render_tree(tree)
    41: 
    42:   - if tree.readme
    43:     = render "tree/readme", readme: tree.readme
  lib/gitlab/git/tree.rb:47:in `entries'
  lib/gitlab/git/tree.rb:25:in `trees'
  app/models/tree.rb:9:in `method_missing'
  app/helpers/tree_helper.rb:8:in `render_tree'
  app/views/tree/_tree.html.haml:40:in `_app_views_tree__tree_html_haml___2427405339265974657_67230440'
  app/views/tree/show.html.haml:4:in `_app_views_tree_show_html_haml___2260869102114516074_64694300'
  app/controllers/tree_controller.rb:14:in `show'


Started GET "/static.css" for 127.0.0.1 at 2013-05-02 11:27:25 +0000
Processing by ProjectsController#show as HTML
  Parameters: {"id"=>"static.css"}
  Rendered public/404.html (0.0ms)
Filter chain halted as :project rendered or redirected
Completed 404 Not Found in 2ms (Views: 0.4ms | ActiveRecord: 0.1ms)

Directly opening http://git.example.com/project_namespace/project_repo/blob/master/README.md and http://git.example.com/project_namespace/project_repo/blob/stable/README.md is working. Just using the combo box to select the branch results in an error.

Assignee
Assign to
Time tracking