diff options
author | Robert Speicher <robert@gitlab.com> | 2017-05-16 20:13:02 +0000 |
---|---|---|
committer | Regis <boudinot.regis@yahoo.com> | 2017-05-18 20:25:16 -0600 |
commit | a72a3cc25140b68f0868e834c2e246982fa9f44d (patch) | |
tree | a96ac8121f3a1dde3a5488f80a78e3acf8aa0fb8 /lib | |
parent | e2d7eb8863abd445ddf0b5b83c01d0b5c4da67dd (diff) | |
download | gitlab-ce-a72a3cc25140b68f0868e834c2e246982fa9f44d.tar.gz |
Merge branch 'reenable-gitaly-ref-name' into 'master'
Re-enable gitaly migration for ref_name_for_sha after bugfixes
See merge request !11310
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/repository.rb | 26 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/ref.rb | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 9386f06e6a6..239dc663598 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -471,19 +471,19 @@ module Gitlab # Returns a RefName for a given SHA def ref_name_for_sha(ref_path, sha) - # NOTE: This feature is intentionally disabled until - # https://gitlab.com/gitlab-org/gitaly/issues/180 is resolved - # Gitlab::GitalyClient.migrate(:find_ref_name) do |is_enabled| - # if is_enabled - # gitaly_ref_client.find_ref_name(sha, ref_path) - # else - args = %W(#{Gitlab.config.git.bin_path} for-each-ref --count=1 #{ref_path} --contains #{sha}) - - # Not found -> ["", 0] - # Found -> ["b8d95eb4969eefacb0a58f6a28f6803f8070e7b9 commit\trefs/environments/production/77\n", 0] - Gitlab::Popen.popen(args, @path).first.split.last - # end - # end + raise ArgumentError, "sha can't be empty" unless sha.present? + + gitaly_migrate(:find_ref_name) do |is_enabled| + if is_enabled + gitaly_ref_client.find_ref_name(sha, ref_path) + else + args = %W(#{Gitlab.config.git.bin_path} for-each-ref --count=1 #{ref_path} --contains #{sha}) + + # Not found -> ["", 0] + # Found -> ["b8d95eb4969eefacb0a58f6a28f6803f8070e7b9 commit\trefs/environments/production/77\n", 0] + Gitlab::Popen.popen(args, @path).first.split.last + end + end end # Returns commits collection diff --git a/lib/gitlab/gitaly_client/ref.rb b/lib/gitlab/gitaly_client/ref.rb index bf04e1fa50b..53c43e28df8 100644 --- a/lib/gitlab/gitaly_client/ref.rb +++ b/lib/gitlab/gitaly_client/ref.rb @@ -28,7 +28,7 @@ module Gitlab def find_ref_name(commit_id, ref_prefix) request = Gitaly::FindRefNameRequest.new( - repository: @repository, + repository: @gitaly_repo, commit_id: commit_id, prefix: ref_prefix ) |