Commit a5e8ea54 authored by Stan Hu's avatar Stan Hu
Browse files

Fix Error 500 when browsing projects with no HEAD

Steps to reproduce:
1. Create a project with a README
2. In the actual remote, type: `git symbolic-ref HEAD refs/heads/nowhere`
3. Check that HEAD is gone via `git ls-remote .`
4. Go to the projects page and see the Error 500

parent 72b5c029d311
Please view this file on the master branch, on stable branches it's out of date.
v 7.14.0 (unreleased)
- Fix Error 500 when browsing projects with no HEAD (Stan Hu)
- Fix full screen mode for snippet comments (Daniel Gerhardt)
- Fix 404 error in files view after deleting the last file in a repository (Stan Hu)
- Fix label read access for unauthenticated users (Daniel Gerhardt)
......@@ -278,7 +278,8 @@ def last_push_event
def readme_cache_key
[, @project.commit.sha, "readme"].join('-')
sha = @project.commit.try(:sha) || 'nil'
[, sha, "readme"].join('-')
def round_commit_count(project)
......@@ -22,7 +22,7 @@
let(:user) { create(:user) }
it "returns false if there are no approipriate permissions" do
it "returns false if there are no appropriate permissions" do
allow(helper).to receive(:can?) { false }
expect(helper.can_change_visibility_level?(project, user)).to be_falsey
......@@ -52,4 +52,22 @@
describe "readme_cache_key" do
let(:project) { create(:project) }
before do
helper.instance_variable_set(:@project, project)
it "returns a valid cach key" do
expect(helper.send(:readme_cache_key)).to eq("#{}-#{}-readme")
it "returns a valid cache key if HEAD does not exist" do
allow(project).to receive(:commit) { nil }
expect(helper.send(:readme_cache_key)).to eq("#{}-nil-readme")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment