From 6a267b32c2a6c100016344c33a175ecc7b0fc924 Mon Sep 17 00:00:00 2001 From: ash Date: Sat, 18 May 2013 18:28:21 +0000 Subject: Log during failure cases of fork-project. --- lib/gitlab_projects.rb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/gitlab_projects.rb') diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 1189949..2b8bbed 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -103,15 +103,24 @@ class GitlabProjects new_namespace = ARGV.shift # destination namespace must be provided - return false unless new_namespace + unless new_namespace + $logger.error "fork-project failed: no destination namespace provided." + return false + end - #destination namespace must exist + # destination namespace must exist namespaced_path = File.join(repos_path, new_namespace) - return false unless File.exists?(namespaced_path) + unless File.exists?(namespaced_path) + $logger.error "fork-project failed: destination namespace <#{namespaced_path}> does not exist." + return false + end - #a project of the same name cannot already be within the destination namespace + # a project of the same name cannot already be within the destination namespace full_destination_path = File.join(namespaced_path, project_name.split('/')[-1]) - return false if File.exists?(full_destination_path) + if File.exists?(full_destination_path) + $logger.error "fork-project failed: destination repository <#{full_destination_path}> already exists." + return false + end $logger.info "Forking project from <#{full_path}> to <#{full_destination_path}>." cmd = "cd #{namespaced_path} && git clone --bare #{full_path} && #{create_hooks_to(full_destination_path)}" -- cgit v1.2.1