summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/hooks_service.rb
diff options
context:
space:
mode:
authorDavid Turner <dturner@twosigma.com>2017-08-02 14:14:50 -0400
committerDavid Turner <novalis@novalis.org>2017-09-29 18:12:03 -0400
commitdbcf48af8b21c0f1e54b73ea421911028081e1c1 (patch)
tree079829ac40d22cd745749d8cfaf5c56c21c4112d /lib/gitlab/git/hooks_service.rb
parent999b7e553b1e1e04c2be4289b94557813f140cfe (diff)
downloadgitlab-ce-dbcf48af8b21c0f1e54b73ea421911028081e1c1.tar.gz
Add username as GL_USERNAME in hooks (http)
When calling pre-receive, post-receive, and update hooks, add the GitLab username as the GL_USERNAME environment variable. This patch only handles cases where pushes are over http, or via the web interface. Later, we will address the ssh case.
Diffstat (limited to 'lib/gitlab/git/hooks_service.rb')
-rw-r--r--lib/gitlab/git/hooks_service.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/gitlab/git/hooks_service.rb b/lib/gitlab/git/hooks_service.rb
index ea8a87a1290..c327e9b1616 100644
--- a/lib/gitlab/git/hooks_service.rb
+++ b/lib/gitlab/git/hooks_service.rb
@@ -5,12 +5,13 @@ module Gitlab
attr_accessor :oldrev, :newrev, :ref
- def execute(committer, repository, oldrev, newrev, ref)
- @repository = repository
- @gl_id = committer.gl_id
- @oldrev = oldrev
- @newrev = newrev
- @ref = ref
+ def execute(pusher, repository, oldrev, newrev, ref)
+ @repository = repository
+ @gl_id = pusher.gl_id
+ @gl_username = pusher.name
+ @oldrev = oldrev
+ @newrev = newrev
+ @ref = ref
%w(pre-receive update).each do |hook_name|
status, message = run_hook(hook_name)
@@ -29,7 +30,7 @@ module Gitlab
def run_hook(name)
hook = Gitlab::Git::Hook.new(name, @repository)
- hook.trigger(@gl_id, oldrev, newrev, ref)
+ hook.trigger(@gl_id, @gl_username, oldrev, newrev, ref)
end
end
end