From 047dcb86af85a4f1a56cf34baff036af1aa3c222 Mon Sep 17 00:00:00 2001 From: Angus MacArthur Date: Tue, 16 Apr 2013 11:56:39 -0400 Subject: additional fork check and enhanced tests --- lib/gitlab_projects.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/gitlab_projects.rb') diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 154ada1..1c2128e 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -86,11 +86,16 @@ class GitlabProjects def fork_project new_namespace = ARGV.shift + # destination namespace must be provided return false unless new_namespace + #destination namespace must exist namespaced_path = File.join(repos_path, new_namespace) return false unless File.exists?(namespaced_path) + + #a project of the same name cannot already be within the destination namespace full_destination_path = File.join(namespaced_path, project_name) + return false if File.exists?(full_destination_path) cmd = "cd #{namespaced_path} && git clone --bare #{full_path} && #{create_hooks_to(full_destination_path)}" system(cmd) -- cgit v1.2.1