diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2018-05-14 16:55:27 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2018-05-14 16:55:27 +0300 |
commit | 7fc185ab25826cf8508c2408711755522d644c60 (patch) | |
tree | c3ae45c964b37ba4cebc131d5b8b6ffbe77fa72f /lib/gitlab | |
parent | 40683268b2b5ad807194387d8345a30195e178c4 (diff) |
Ref contains oid check done by Gitaly
These two endpoints are in opt-out, and no one noticed. Has been running
on .com for 4 months now and considered stable.
Closes https://gitlab.com/gitlab-org/gitaly/issues/884
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/git/repository.rb | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 29a3a35812c..25487f53999 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1467,25 +1467,11 @@ module Gitlab end def branch_names_contains_sha(sha) - gitaly_migrate(:branch_names_contains_sha, - status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled| - if is_enabled - gitaly_ref_client.branch_names_contains_sha(sha) - else - refs_contains_sha('refs/heads/', sha) - end - end + gitaly_ref_client.branch_names_contains_sha(sha) end def tag_names_contains_sha(sha) - gitaly_migrate(:tag_names_contains_sha, - status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled| - if is_enabled - gitaly_ref_client.tag_names_contains_sha(sha) - else - refs_contains_sha('refs/tags/', sha) - end - end + gitaly_ref_client.tag_names_contains_sha(sha) end def search_files_by_content(query, ref) @@ -1620,27 +1606,6 @@ module Gitlab end end - def refs_contains_sha(refs_prefix, sha) - refs_prefix << "/" unless refs_prefix.ends_with?('/') - - # By forcing the output to %(refname) each line wiht a ref will start with - # the ref prefix. All other lines can be discarded. - args = %W(for-each-ref --contains=#{sha} --format=%(refname) #{refs_prefix}) - names, code = run_git(args) - - return [] unless code.zero? - - refs = [] - left_slice_count = refs_prefix.length - names.lines.each do |line| - next unless line.start_with?(refs_prefix) - - refs << encode_utf8(line.rstrip[left_slice_count..-1]) - end - - refs - end - def rugged_write_config(full_path:) rugged.config['gitlab.fullpath'] = full_path end |