diff options
author | Robert Speicher <robert@gitlab.com> | 2016-02-06 00:45:48 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-02-06 00:45:48 +0300 |
commit | 70b7eacfb257f2f7473136789adf8c8a1fa872fb (patch) | |
tree | 45af80251dbfb5f4616a329b813417a44a95a290 /app | |
parent | 26f3cc41fc41f2901cc560aaecf1fe49cadda7ca (diff) | |
parent | b263ab618c59ff9e377780c6120ab60fd97aefd0 (diff) |
Merge branch 'improve-diverging-commit-counts' into 'master'
Dedicated method for counting commits between refs
Corresponding gitlab_git merge request: https://gitlab.com/gitlab-org/gitlab_git/merge_requests/66
Issue that lead to these changes: https://gitlab.com/gitlab-org/gitlab-ce/issues/12619
See merge request !2707
Diffstat (limited to 'app')
-rw-r--r-- | app/models/repository.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 130daddd9d1..e813c946bc1 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -184,8 +184,11 @@ class Repository cache.fetch(:"diverging_commit_counts_#{branch.name}") do # Rugged seems to throw a `ReferenceError` when given branch_names rather # than SHA-1 hashes - number_commits_behind = commits_between(branch.target, root_ref_hash).size - number_commits_ahead = commits_between(root_ref_hash, branch.target).size + number_commits_behind = raw_repository. + count_commits_between(branch.target, root_ref_hash) + + number_commits_ahead = raw_repository. + count_commits_between(root_ref_hash, branch.target) { behind: number_commits_behind, ahead: number_commits_ahead } end |