Skip to content

Commit

Permalink
Merge branch 'remove_empty_post_receive' of /home/git/repositories/gi…
Browse files Browse the repository at this point in the history
…tlab/gitlab-shell
  • Loading branch information
dzaporozhets committed Jul 19, 2013
2 parents f13afa2 + 2537a0b commit d3c3fbc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 30 deletions.
4 changes: 0 additions & 4 deletions hooks/post-receive

This file was deleted.

5 changes: 1 addition & 4 deletions lib/gitlab_projects.rb
Expand Up @@ -182,9 +182,6 @@ def update_head
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
2 changes: 0 additions & 2 deletions spec/gitlab_projects_spec.rb
Expand Up @@ -101,7 +101,6 @@

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
Expand Down Expand Up @@ -238,7 +237,6 @@
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
Expand Down
26 changes: 6 additions & 20 deletions support/rewrite-hooks.sh
Expand Up @@ -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
Expand Down

0 comments on commit d3c3fbc

Please sign in to comment.