diff options
author | Stan Hu <stanhu@gmail.com> | 2015-07-24 09:52:21 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-07-24 20:14:58 +0300 |
commit | a5e8ea54eceeb02fe34f0265d8cfe6af8b599098 (patch) | |
tree | 595e52ba7c91ed6eeb99bd7c94d0642448727eff /app | |
parent | 5dd4dea93baa6386ed860a50125dce3ca3890f16 (diff) |
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
Closes https://github.com/gitlabhq/gitlabhq/issues/9484
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/projects_helper.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 3cd52b381bd..a675a292432 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -278,7 +278,8 @@ module ProjectsHelper end def readme_cache_key - [@project.id, @project.commit.sha, "readme"].join('-') + sha = @project.commit.try(:sha) || 'nil' + [@project.id, sha, "readme"].join('-') end def round_commit_count(project) |