Commit 476cd0f7638df222fec3487a2d5fbc6129139bdc
Exists in
spb-stable
and in
2 other branches
Merge branch 'commit-count' into 'master'
Project commit count for default branch Currently, the commit count displayed on a project's home page shows the total number of commits on the master branch. This can lead to situations in which a project may have no commits reported or very few if the project workflow does not involve the use of a branch named "master". Since number of commits can be an indicator of project health, showing 0 commits could make it harder to encourage adoption of a project. This MR alters the repository model's `commit_count` method to return the count for the default branch instead of master. See issue #299
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
app/models/repository.rb
@@ -106,7 +106,7 @@ class Repository | @@ -106,7 +106,7 @@ class Repository | ||
106 | def commit_count | 106 | def commit_count |
107 | Rails.cache.fetch(cache_key(:commit_count)) do | 107 | Rails.cache.fetch(cache_key(:commit_count)) do |
108 | begin | 108 | begin |
109 | - raw_repository.raw.commit_count | 109 | + raw_repository.raw.commit_count(self.root_ref) |
110 | rescue | 110 | rescue |
111 | 0 | 111 | 0 |
112 | end | 112 | end |