summaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'hooks')
-rwxr-xr-xhooks/post-receive17
-rwxr-xr-xhooks/pre-receive (renamed from hooks/update)12
2 files changed, 25 insertions, 4 deletions
diff --git a/hooks/post-receive b/hooks/post-receive
new file mode 100755
index 0000000..d85ad42
--- /dev/null
+++ b/hooks/post-receive
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+
+# This file was placed here by GitLab. It makes sure that your pushed commits
+# will be processed properly.
+# You can add your own hooks to this file, but be careful when updating gitlab-shell!
+
+changes = ARGF.read
+key_id = ENV['GL_ID']
+repo_path = Dir.pwd
+
+require_relative '../lib/gitlab_post_receive'
+
+if GitlabPostReceive.new(repo_path, key_id, changes).exec
+ exit 0
+else
+ exit 1
+end
diff --git a/hooks/update b/hooks/pre-receive
index 549afeb..2b979fa 100755
--- a/hooks/update
+++ b/hooks/pre-receive
@@ -4,10 +4,14 @@
# will be processed properly.
# You can add your own hooks to this file, but be careful when updating gitlab-shell!
-refname = ARGV[0]
+refs = ARGF.read
key_id = ENV['GL_ID']
-repo_path = `pwd`
+repo_path = Dir.pwd
-require_relative '../lib/gitlab_update'
+require_relative '../lib/gitlab_access'
-GitlabUpdate.new(repo_path, key_id, refname).exec
+if GitlabAccess.new(repo_path, key_id, refs).exec
+ exit 0
+else
+ exit 1
+end