summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-19 14:17:40 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-19 14:17:40 +0000
commitd3c3fbc6163ca13b16351214349bd5a7f5b729a3 (patch)
treeb49730431721b6f2238b59573bed5113f8181fa1
parentf13afa2db3f3b44a9a6f97b88eced3f324f80b51 (diff)
parent2537a0b24cac9206f282a071ba5e930aabfc3135 (diff)
downloadgitlab-shell-d3c3fbc6163ca13b16351214349bd5a7f5b729a3.tar.gz
Merge branch 'remove_empty_post_receive' of /home/git/repositories/gitlab/gitlab-shell
-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.sh26
4 files changed, 7 insertions, 30 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 1d0542e..3c96b6f 100755
--- a/support/rewrite-hooks.sh
+++ b/support/rewrite-hooks.sh
@@ -6,35 +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" = "gitolite-admin.git" ]
- then
- continue
- fi
-
if [[ "$dir" =~ ^.*\.git$ ]]
then
- project_hook="$src/$dir/hooks/post-receive"
- gitolite_hook="$home_dir/gitlab-shell/hooks/post-receive"
- ln -s -f $gitolite_hook $project_hook
-
- project_hook="$src/$dir/hooks/update"
- gitolite_hook="$home_dir/gitlab-shell/hooks/update"
- ln -s -f $gitolite_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"
- gitolite_hook="$home_dir/gitlab-shell/hooks/post-receive"
- ln -s -f $gitolite_hook $project_hook
-
- project_hook="$src/$dir/$subdir/hooks/update"
- gitolite_hook="$home_dir/gitlab-shell/hooks/update"
- ln -s -f $gitolite_hook $project_hook
+ create_link_in "$src/$dir/$subdir"
fi
done
fi