summaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-04-28 17:10:42 -0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-05-11 12:21:31 -0300
commitee259653e7a00359740ca36cef606f9c3cc1a7cb (patch)
tree6f53403454defd386c4455a6a9ffcf052d4c6695 /hooks
parent1cf14770f3bf5c3255f4c3a8f69ccfab74317fcd (diff)
downloadgitlab-shell-ee259653e7a00359740ca36cef606f9c3cc1a7cb.tar.gz
Handle GL_REPOSITORY env variable and use it in api calls
Diffstat (limited to 'hooks')
-rwxr-xr-xhooks/post-receive3
-rwxr-xr-xhooks/pre-receive3
2 files changed, 4 insertions, 2 deletions
diff --git a/hooks/post-receive b/hooks/post-receive
index 7877306..3504a48 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -5,12 +5,13 @@
refs = $stdin.read
key_id = ENV.delete('GL_ID')
+gl_repository = ENV.delete('GL_REPOSITORY')
repo_path = Dir.pwd
require_relative '../lib/gitlab_custom_hook'
require_relative '../lib/gitlab_post_receive'
-if GitlabPostReceive.new(repo_path, key_id, refs).exec &&
+if GitlabPostReceive.new(gl_repository, repo_path, key_id, refs).exec &&
GitlabCustomHook.new(repo_path, key_id).post_receive(refs)
exit 0
else
diff --git a/hooks/pre-receive b/hooks/pre-receive
index 1b16fd0..e8e04d8 100755
--- a/hooks/pre-receive
+++ b/hooks/pre-receive
@@ -7,6 +7,7 @@ refs = $stdin.read
key_id = ENV.delete('GL_ID')
protocol = ENV.delete('GL_PROTOCOL')
repo_path = Dir.pwd
+gl_repository = ENV['GL_REPOSITORY']
require_relative '../lib/gitlab_custom_hook'
require_relative '../lib/gitlab_reference_counter'
@@ -16,7 +17,7 @@ require_relative '../lib/gitlab_access'
# last so that it only runs if everything else succeeded. On post-receive on the
# other hand, we run GitlabPostReceive first because the push is already done
# and we don't want to skip it if the custom hook fails.
-if GitlabAccess.new(repo_path, key_id, refs, protocol).exec &&
+if GitlabAccess.new(gl_repository, repo_path, key_id, refs, protocol).exec &&
GitlabCustomHook.new(repo_path, key_id).pre_receive(refs) &&
GitlabReferenceCounter.new(repo_path).increase
exit 0