diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-02-12 07:53:13 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-02-12 07:53:13 +0000 |
commit | 91f74f455ed606d78c4d0b8844dce819266f80c6 (patch) | |
tree | 564e7f03756e49a20872c1a569d03e3062966305 /app/models | |
parent | 42c7be1ec0a224a8ebfd880e911b10f4a60420a0 (diff) | |
parent | b502d90a9f0521247e8c42f1ed586f6f4a52507a (diff) | |
download | gitlab-ce-91f74f455ed606d78c4d0b8844dce819266f80c6.tar.gz |
Merge branch 'add-client-for-count-diverging-commits' into 'master'
add client support for CountDivergingCommits rpc
See merge request gitlab-org/gitlab-ce!24287
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/repository.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 7c50b4488e5..ed55a6e572b 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -288,13 +288,16 @@ class Repository # Rugged seems to throw a `ReferenceError` when given branch_names rather # than SHA-1 hashes number_commits_behind, number_commits_ahead = - raw_repository.count_commits_between( + raw_repository.diverging_commit_count( @root_ref_hash, branch.dereferenced_target.sha, - left_right: true, max_count: MAX_DIVERGING_COUNT) - { behind: number_commits_behind, ahead: number_commits_ahead } + if number_commits_behind + number_commits_ahead >= MAX_DIVERGING_COUNT + { distance: MAX_DIVERGING_COUNT } + else + { behind: number_commits_behind, ahead: number_commits_ahead } + end end end |