Skip to content

Fix broken view when viewing history of a file that includes a path that used to be a file

Stan Hu requested to merge stanhu/gitlab_git:fix-blob-path into master

A 500 Error would occur if you viewed the history of a file that includes a path that used to be a file:

Completed 500 Internal Server Error in 120ms

NoMethodError (undefined method `[]' for #<Rugged::Blob:0x0000000d57b838>):
  app/models/repository.rb:38:in `commits'
  app/controllers/projects/commits_controller.rb:14:in `show'

The test requires the branch fix-blob-path from https://gitlab.com/stanhu/gitlab-git-test:

git clone git@gitlab.com:gitlab-org/gitlab-git-test.git
cd gitlab-git-test
git remote add stanhu https://gitlab.com/stanhu/gitlab-git-test.git
git fetch stanhu
git checkout -b fix-blob-path stanhu/fix-blob-path
git push -u origin fix-blob-path

Closes gitlab-org/gitlab-ce#1598

Merge request reports