Commit 934aacb3 authored by Angus MacArthur's avatar Angus MacArthur

more fixes for pull reuest

Change-Id: I1b3d64d79187c414e326928a96427d1cc6176224
parent e104bdf1
...@@ -45,10 +45,7 @@ class GitlabProjects ...@@ -45,10 +45,7 @@ class GitlabProjects
end end
def create_hooks_cmd def create_hooks_cmd
pr_hook_path = File.join(ROOT_PATH, 'hooks', 'post-receive') create_hooks_to(full_path)
up_hook_path = File.join(ROOT_PATH, 'hooks', 'update')
"ln -s #{pr_hook_path} #{full_path}/hooks/post-receive && ln -s #{up_hook_path} #{full_path}/hooks/update"
end end
def rm_project def rm_project
...@@ -93,8 +90,20 @@ class GitlabProjects ...@@ -93,8 +90,20 @@ class GitlabProjects
namespaced_path = File.join(repos_path, new_namespace) namespaced_path = File.join(repos_path, new_namespace)
return false unless File.exists?(namespaced_path) return false unless File.exists?(namespaced_path)
full_destination_path = File.join(namespaced_path, project_name)
cmd = "cd #{namespaced_path} && git clone --bare #{full_path}" cmd = "cd #{namespaced_path} && git clone --bare #{full_path} && #{create_hooks_to(full_destination_path)}"
system(cmd) system(cmd)
end end
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"
end
end end
...@@ -90,8 +90,8 @@ describe GitlabProjects do ...@@ -90,8 +90,8 @@ describe GitlabProjects do
it "should fork the repo" do it "should fork the repo" do
gl_projects.exec gl_projects.exec
File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name)).should be_true File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name)).should be_true
File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name, '/hooks/update/post-receive')).should be_true File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name, '/hooks/update')).should be_true
File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name, '/hooks/update/')).should be_true File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name, '/hooks/post-receive')).should be_true
end end
end end
......
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