Skip to content

Commit 2537a0b

Browse files
committed
Remove empty post-receive hook
1 parent 57f7373 commit 2537a0b

File tree

4 files changed

+7
-24
lines changed

4 files changed

+7
-24
lines changed

hooks/post-receive

Lines changed: 0 additions & 4 deletions
This file was deleted.

lib/gitlab_projects.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ def update_head
182182
private
183183

184184
def create_hooks_to(dest_path)
185-
pr_hook_path = File.join(ROOT_PATH, 'hooks', 'post-receive')
186-
up_hook_path = File.join(ROOT_PATH, 'hooks', 'update')
187-
188-
"ln -s #{pr_hook_path} #{dest_path}/hooks/post-receive && ln -s #{up_hook_path} #{dest_path}/hooks/update"
185+
"ln -s #{File.join(ROOT_PATH, 'hooks', 'update')} #{dest_path}/hooks/update"
189186
end
190187
end

spec/gitlab_projects_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101

102102
it "should receive valid cmd" do
103103
valid_cmd = "cd #{tmp_repo_path} && git init --bare"
104-
valid_cmd << " && ln -s #{ROOT_PATH}/hooks/post-receive #{tmp_repo_path}/hooks/post-receive"
105104
valid_cmd << " && ln -s #{ROOT_PATH}/hooks/update #{tmp_repo_path}/hooks/update"
106105
gl_projects.should_receive(:system).with(valid_cmd)
107106
gl_projects.exec
@@ -238,7 +237,6 @@
238237
gl_projects_fork.exec.should be_true
239238
File.exists?(dest_repo).should be_true
240239
File.exists?(File.join(dest_repo, '/hooks/update')).should be_true
241-
File.exists?(File.join(dest_repo, '/hooks/post-receive')).should be_true
242240
end
243241

244242
it "should not fork if a project of the same name already exists" do

support/rewrite-hooks.sh

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,21 @@
66
home_dir="/home/git"
77
src=${1:-"$home_dir/repositories"}
88

9+
function create_link_in {
10+
ln -s -f "$home_dir/gitlab-shell/hooks/update" "$1/hooks/update"
11+
}
12+
913
for dir in `ls "$src/"`
1014
do
1115
if [ -d "$src/$dir" ]; then
1216
if [[ "$dir" =~ ^.*\.git$ ]]
1317
then
14-
project_hook="$src/$dir/hooks/post-receive"
15-
gitlab_shell_hook="$home_dir/gitlab-shell/hooks/post-receive"
16-
ln -s -f $gitlab_shell_hook $project_hook
17-
18-
project_hook="$src/$dir/hooks/update"
19-
gitlab_shell_hook="$home_dir/gitlab-shell/hooks/update"
20-
ln -s -f $gitlab_shell_hook $project_hook
18+
create_link_in "$src/$dir"
2119
else
2220
for subdir in `ls "$src/$dir/"`
2321
do
2422
if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*\.git$ ]]; then
25-
project_hook="$src/$dir/$subdir/hooks/post-receive"
26-
gitlab_shell_hook="$home_dir/gitlab-shell/hooks/post-receive"
27-
ln -s -f $gitlab_shell_hook $project_hook
28-
29-
project_hook="$src/$dir/$subdir/hooks/update"
30-
gitlab_shell_hook="$home_dir/gitlab-shell/hooks/update"
31-
ln -s -f $gitlab_shell_hook $project_hook
23+
create_link_in "$src/$dir/$subdir"
3224
fi
3325
done
3426
fi

0 commit comments

Comments
 (0)