summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2013-07-19 14:11:49 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2013-07-19 15:28:10 +0200
commit2537a0b24cac9206f282a071ba5e930aabfc3135 (patch)
treeb49730431721b6f2238b59573bed5113f8181fa1
parent57f73737903e37af4651e017be4e769dea6cb4d3 (diff)
downloadgitlab-shell-2537a0b24cac9206f282a071ba5e930aabfc3135.tar.gz
Remove empty post-receive hook
-rwxr-xr-xhooks/post-receive4
-rw-r--r--lib/gitlab_projects.rb5
-rw-r--r--spec/gitlab_projects_spec.rb2
-rwxr-xr-xsupport/rewrite-hooks.sh20
4 files changed, 7 insertions, 24 deletions
diff --git a/hooks/post-receive b/hooks/post-receive
deleted file mode 100755
index 98fe81b..0000000
--- a/hooks/post-receive
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env ruby
-
-# This file was placed here by GitLab.
-# You can put your own hook here, but be careful when updating gitlab-shell!
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index c933296..242384b 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -182,9 +182,6 @@ class GitlabProjects
private
def create_hooks_to(dest_path)
- pr_hook_path = File.join(ROOT_PATH, 'hooks', 'post-receive')
- up_hook_path = File.join(ROOT_PATH, 'hooks', 'update')
-
- "ln -s #{pr_hook_path} #{dest_path}/hooks/post-receive && ln -s #{up_hook_path} #{dest_path}/hooks/update"
+ "ln -s #{File.join(ROOT_PATH, 'hooks', 'update')} #{dest_path}/hooks/update"
end
end
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb
index 1c02430..6ff72ec 100644
--- a/spec/gitlab_projects_spec.rb
+++ b/spec/gitlab_projects_spec.rb
@@ -101,7 +101,6 @@ 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/post-receive #{tmp_repo_path}/hooks/post-receive"
valid_cmd << " && ln -s #{ROOT_PATH}/hooks/update #{tmp_repo_path}/hooks/update"
gl_projects.should_receive(:system).with(valid_cmd)
gl_projects.exec
@@ -238,7 +237,6 @@ describe GitlabProjects do
gl_projects_fork.exec.should be_true
File.exists?(dest_repo).should be_true
File.exists?(File.join(dest_repo, '/hooks/update')).should be_true
- File.exists?(File.join(dest_repo, '/hooks/post-receive')).should be_true
end
it "should not fork if a project of the same name already exists" do
diff --git a/support/rewrite-hooks.sh b/support/rewrite-hooks.sh
index 3c4efa4..3c96b6f 100755
--- a/support/rewrite-hooks.sh
+++ b/support/rewrite-hooks.sh
@@ -6,29 +6,21 @@
home_dir="/home/git"
src=${1:-"$home_dir/repositories"}
+function create_link_in {
+ ln -s -f "$home_dir/gitlab-shell/hooks/update" "$1/hooks/update"
+}
+
for dir in `ls "$src/"`
do
if [ -d "$src/$dir" ]; then
if [[ "$dir" =~ ^.*\.git$ ]]
then
- project_hook="$src/$dir/hooks/post-receive"
- gitlab_shell_hook="$home_dir/gitlab-shell/hooks/post-receive"
- ln -s -f $gitlab_shell_hook $project_hook
-
- project_hook="$src/$dir/hooks/update"
- gitlab_shell_hook="$home_dir/gitlab-shell/hooks/update"
- ln -s -f $gitlab_shell_hook $project_hook
+ create_link_in "$src/$dir"
else
for subdir in `ls "$src/$dir/"`
do
if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*\.git$ ]]; then
- project_hook="$src/$dir/$subdir/hooks/post-receive"
- gitlab_shell_hook="$home_dir/gitlab-shell/hooks/post-receive"
- ln -s -f $gitlab_shell_hook $project_hook
-
- project_hook="$src/$dir/$subdir/hooks/update"
- gitlab_shell_hook="$home_dir/gitlab-shell/hooks/update"
- ln -s -f $gitlab_shell_hook $project_hook
+ create_link_in "$src/$dir/$subdir"
fi
done
fi