Commit d3c3fbc6 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'remove_empty_post_receive' of /home/git/repositories/gitlab/gitlab-shell

parents f13afa2d 2537a0b2
#!/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!
...@@ -182,9 +182,6 @@ class GitlabProjects ...@@ -182,9 +182,6 @@ class GitlabProjects
private private
def create_hooks_to(dest_path) def create_hooks_to(dest_path)
pr_hook_path = File.join(ROOT_PATH, 'hooks', 'post-receive') "ln -s #{File.join(ROOT_PATH, 'hooks', 'update')} #{dest_path}/hooks/update"
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"
end end
end end
...@@ -101,7 +101,6 @@ describe GitlabProjects do ...@@ -101,7 +101,6 @@ describe GitlabProjects do
it "should receive valid cmd" do it "should receive valid cmd" do
valid_cmd = "cd #{tmp_repo_path} && git init --bare" 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" valid_cmd << " && ln -s #{ROOT_PATH}/hooks/update #{tmp_repo_path}/hooks/update"
gl_projects.should_receive(:system).with(valid_cmd) gl_projects.should_receive(:system).with(valid_cmd)
gl_projects.exec gl_projects.exec
...@@ -238,7 +237,6 @@ describe GitlabProjects do ...@@ -238,7 +237,6 @@ describe GitlabProjects do
gl_projects_fork.exec.should be_true gl_projects_fork.exec.should be_true
File.exists?(dest_repo).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/update')).should be_true
File.exists?(File.join(dest_repo, '/hooks/post-receive')).should be_true
end end
it "should not fork if a project of the same name already exists" do it "should not fork if a project of the same name already exists" do
......
...@@ -6,35 +6,21 @@ ...@@ -6,35 +6,21 @@
home_dir="/home/git" home_dir="/home/git"
src=${1:-"$home_dir/repositories"} 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/"` for dir in `ls "$src/"`
do do
if [ -d "$src/$dir" ]; then if [ -d "$src/$dir" ]; then
if [ "$dir" = "gitolite-admin.git" ]
then
continue
fi
if [[ "$dir" =~ ^.*\.git$ ]] if [[ "$dir" =~ ^.*\.git$ ]]
then then
project_hook="$src/$dir/hooks/post-receive" create_link_in "$src/$dir"
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
else else
for subdir in `ls "$src/$dir/"` for subdir in `ls "$src/$dir/"`
do do
if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*\.git$ ]]; then if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*\.git$ ]]; then
project_hook="$src/$dir/$subdir/hooks/post-receive" create_link_in "$src/$dir/$subdir"
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
fi fi
done done
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment