diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-07-01 08:38:16 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-07-01 08:38:16 +0000 |
commit | 8775e4a1faf13a01451e71ea9ef729dc52e6d3c1 (patch) | |
tree | 8632c5465f6b3dee57bb0ccd64f5162c35b8ab15 /app/models | |
parent | f63dc06cb4572db92bb91c936e9862c55f1f365e (diff) | |
parent | ca5cd7b7fb5108d30d0f6b74e31da736024592dd (diff) | |
download | gitlab-ce-8775e4a1faf13a01451e71ea9ef729dc52e6d3c1.tar.gz |
Merge branch 'id-stale-branches' into 'master'
Add endpoint for fetching diverging commit counts
See merge request gitlab-org/gitlab-ce!29802
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/repository.rb | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index e05d3dd58ac..992ed7485e5 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -282,46 +282,6 @@ class Repository ref_exists?(keep_around_ref_name(sha)) end - def diverging_commit_counts(branch) - return diverging_commit_counts_without_max(branch) if Feature.enabled?('gitaly_count_diverging_commits_no_max') - - ## TODO: deprecate the below code after 12.0 - @root_ref_hash ||= raw_repository.commit(root_ref).id - cache.fetch(:"diverging_commit_counts_#{branch.name}") do - # Rugged seems to throw a `ReferenceError` when given branch_names rather - # than SHA-1 hashes - branch_sha = branch.dereferenced_target.sha - - number_commits_behind, number_commits_ahead = - raw_repository.diverging_commit_count( - @root_ref_hash, - branch_sha, - max_count: MAX_DIVERGING_COUNT) - - 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 - - def diverging_commit_counts_without_max(branch) - @root_ref_hash ||= raw_repository.commit(root_ref).id - cache.fetch(:"diverging_commit_counts_without_max_#{branch.name}") do - # Rugged seems to throw a `ReferenceError` when given branch_names rather - # than SHA-1 hashes - branch_sha = branch.dereferenced_target.sha - - number_commits_behind, number_commits_ahead = - raw_repository.diverging_commit_count( - @root_ref_hash, - branch_sha) - - { behind: number_commits_behind, ahead: number_commits_ahead } - end - end - def archive_metadata(ref, storage_path, format = "tar.gz", append_sha:, path: nil) raw_repository.archive_metadata( ref, |