summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngus MacArthur <amacarthur@blackberry.com>2013-04-16 01:09:22 -0400
committerAngus MacArthur <amacarthur@blackberry.com>2013-04-16 01:09:22 -0400
commit934aacb34ba65cd47ce8fefd4cad64c4a3951856 (patch)
tree8e98d8e3ce3f2cb2a032da47ce4fb88b52bc7572
parente104bdf13f66319b450243c6dcb1d199e554b431 (diff)
downloadgitlab-shell-934aacb34ba65cd47ce8fefd4cad64c4a3951856.tar.gz
more fixes for pull reuest
Change-Id: I1b3d64d79187c414e326928a96427d1cc6176224
-rw-r--r--lib/gitlab_projects.rb19
-rw-r--r--spec/gitlab_projects_spec.rb4
2 files changed, 16 insertions, 7 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index d726f32..154ada1 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -45,10 +45,7 @@ class GitlabProjects
end
def create_hooks_cmd
- pr_hook_path = File.join(ROOT_PATH, 'hooks', 'post-receive')
- 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"
+ create_hooks_to(full_path)
end
def rm_project
@@ -93,8 +90,20 @@ class GitlabProjects
namespaced_path = File.join(repos_path, new_namespace)
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)
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
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb
index ef7fa96..f9d63b0 100644
--- a/spec/gitlab_projects_spec.rb
+++ b/spec/gitlab_projects_spec.rb
@@ -90,8 +90,8 @@ describe GitlabProjects do
it "should fork the repo" do
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, '/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