summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-01 18:57:43 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-01 18:57:43 +0300
commitc6909d0c941784d60cb552d5685e1ff808323991 (patch)
tree6345045fc3eb928caa0fbf9d9604ff94c2e9cf12
parent99fa0c6e878ed7e5e6292a87524bd43edfafbc9f (diff)
downloadgitlab-shell-c6909d0c941784d60cb552d5685e1ff808323991.tar.gz
Add new pre-receive and post-receive hooks
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rwxr-xr-xhooks/post-receive17
-rwxr-xr-xhooks/pre-receive17
2 files changed, 34 insertions, 0 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/pre-receive b/hooks/pre-receive
new file mode 100755
index 0000000..2b979fa
--- /dev/null
+++ b/hooks/pre-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!
+
+refs = ARGF.read
+key_id = ENV['GL_ID']
+repo_path = Dir.pwd
+
+require_relative '../lib/gitlab_access'
+
+if GitlabAccess.new(repo_path, key_id, refs).exec
+ exit 0
+else
+ exit 1
+end