summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab_net.rb13
-rw-r--r--lib/gitlab_post_receive.rb9
2 files changed, 10 insertions, 12 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index fad06d6..d0bc0bc 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -67,11 +67,13 @@ class GitlabNet
JSON.parse(resp.body) rescue {}
end
- def merge_request_urls(gl_repository, repo_path, changes)
+ def merge_request_urls(gl_repository, changes)
changes = changes.join("\n") unless changes.kind_of?(String)
changes = changes.encode('UTF-8', 'ASCII', invalid: :replace, replace: '')
- url = "#{host}/merge_request_urls?project=#{URI.escape(repo_path)}&changes=#{URI.escape(changes)}"
- url += "&gl_repository=#{URI.escape(gl_repository)}" if gl_repository
+ url = "#{host}/merge_request_urls?" \
+ "gl_repository=#{URI.escape(gl_repository)}&" \
+ "changes=#{URI.escape(changes)}"
+
resp = get(url)
JSON.parse(resp.body) rescue []
end
@@ -96,9 +98,8 @@ class GitlabNet
{}
end
- def notify_post_receive(gl_repository, repo_path)
- params = { gl_repository: gl_repository, project: repo_path }
- resp = post("#{host}/notify_post_receive", params)
+ def notify_post_receive(gl_repository)
+ resp = post("#{host}/notify_post_receive", gl_repository: gl_repository)
resp.code == '200'
rescue
diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb
index 00a1b1b..ac2ee5e 100644
--- a/lib/gitlab_post_receive.rb
+++ b/lib/gitlab_post_receive.rb
@@ -33,11 +33,11 @@ class GitlabPostReceive
end
merge_request_urls = GitlabMetrics.measure("merge-request-urls") do
- api.merge_request_urls(@gl_repository, @repo_path, @changes)
+ api.merge_request_urls(gl_repository, changes)
end
print_merge_request_links(merge_request_urls)
- api.notify_post_receive(gl_repository, repo_path)
+ api.notify_post_receive(gl_repository)
rescue GitlabNet::ApiUnreachableError
nil
end
@@ -107,14 +107,11 @@ class GitlabPostReceive
def update_redis
# Encode changes as base64 so we don't run into trouble with non-UTF-8 input.
changes = Base64.encode64(@changes)
- # TODO: Change to `@gl_repository` in next release.
- # See https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/130#note_28747613
- project_identifier = @gl_repository || @repo_path
queue = "#{config.redis_namespace}:queue:post_receive"
msg = JSON.dump({
'class' => 'PostReceive',
- 'args' => [project_identifier, @actor, changes],
+ 'args' => [@gl_repository, @actor, changes],
'jid' => @jid,
'enqueued_at' => Time.now.to_f
})