summaryrefslogtreecommitdiff
path: root/lib/gitlab/git
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-05-11 17:26:51 -0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-05-16 11:43:37 -0400
commitcf09c826a534d782de9cee4d28d3cdfa504099e7 (patch)
tree110d2fb4805c79eca8e009ac5b525315a61103fd /lib/gitlab/git
parent9a10a6bfd563043b9e767f442c23c73f8af5e09b (diff)
downloadgitlab-ce-cf09c826a534d782de9cee4d28d3cdfa504099e7.tar.gz
Re-enable gitaly migration for ref_name_for_sha after bugfixesreenable-gitaly-ref-name
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r--lib/gitlab/git/repository.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index d380c5021ee..a2c01ec4432 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
- # 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
+ 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