diff options
-rwxr-xr-x | hooks/update | 20 | ||||
-rwxr-xr-x | hooks/update.gitlab | 13 | ||||
-rw-r--r-- | spec/gitlab_projects_spec.rb | 1 |
3 files changed, 24 insertions, 10 deletions
diff --git a/hooks/update b/hooks/update index 549afeb..90b0c6b 100755 --- a/hooks/update +++ b/hooks/update @@ -1,13 +1,13 @@ -#!/usr/bin/env ruby +#!/bin/bash +# GitLab update hook -- do not modify! +# To add your own update hook, create an update.local executable -# 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! +hooks_dir="$(cd `dirname $0` && pwd)" +update_gitlab="$hooks_dir/update.gitlab" +update_local="$hooks_dir/update.local" -refname = ARGV[0] -key_id = ENV['GL_ID'] -repo_path = `pwd` +$update_gitlab "$@" || exit 1 -require_relative '../lib/gitlab_update' - -GitlabUpdate.new(repo_path, key_id, refname).exec +if [ -x $update_local ]; then + $update_local "$@" || exit 1 +fi diff --git a/hooks/update.gitlab b/hooks/update.gitlab new file mode 100755 index 0000000..0979926 --- /dev/null +++ b/hooks/update.gitlab @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby + +# This file was placed here by GitLab. It makes sure that your pushed commits +# will be processed properly. See the `update` script for instructions on how +# to add your own update hooks. + +refname = ARGV[0] +key_id = ENV['GL_ID'] +repo_path = `pwd` + +require_relative '../lib/gitlab_update' + +GitlabUpdate.new(repo_path, key_id, refname).exec diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb index 2b36b34..c0faf15 100644 --- a/spec/gitlab_projects_spec.rb +++ b/spec/gitlab_projects_spec.rb @@ -102,6 +102,7 @@ describe GitlabProjects do it "should receive valid cmd" do valid_cmd = "cd #{tmp_repo_path} && git init --bare" valid_cmd << " && ln -s #{ROOT_PATH}/hooks/update #{tmp_repo_path}/hooks/" + valid_cmd << " && ln -s #{ROOT_PATH}/hooks/update.gitlab #{tmp_repo_path}/hooks/" gl_projects.should_receive(:system).with(valid_cmd) gl_projects.exec end |