summaryrefslogtreecommitdiff
path: root/lib/gitlab/gitaly_client/notifications.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/gitaly_client/notifications.rb')
-rw-r--r--lib/gitlab/gitaly_client/notifications.rb13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/gitlab/gitaly_client/notifications.rb b/lib/gitlab/gitaly_client/notifications.rb
index cbfb129c002..f0d93ded91b 100644
--- a/lib/gitlab/gitaly_client/notifications.rb
+++ b/lib/gitlab/gitaly_client/notifications.rb
@@ -3,18 +3,13 @@ module Gitlab
class Notifications
attr_accessor :stub
- def initialize(repo_path)
- full_path = Gitlab::RepoPath.strip_storage_path(repo_path).
- sub(/\.git\z/, '').sub(/\.wiki\z/, '')
- @project = Project.find_by_full_path(full_path)
-
- channel = GitalyClient.get_channel(@project.repository_storage)
- @stub = Gitaly::Notifications::Stub.new(nil, nil, channel_override: channel)
+ def initialize(repository_storage, relative_path)
+ @channel, @repository = Util.process_path(repository_storage, relative_path)
+ @stub = Gitaly::Notifications::Stub.new(nil, nil, channel_override: @channel)
end
def post_receive
- repository = Gitaly::Repository.new(path: @project.repository.path_to_repo)
- request = Gitaly::PostReceiveRequest.new(repository: repository)
+ request = Gitaly::PostReceiveRequest.new(repository: @repository)
@stub.post_receive(request)
end
end