diff options
author | ash <smashwilson@gmail.com> | 2013-05-18 18:28:21 +0000 |
---|---|---|
committer | ash <smashwilson@gmail.com> | 2013-05-18 18:28:21 +0000 |
commit | 6a267b32c2a6c100016344c33a175ecc7b0fc924 (patch) | |
tree | 7f35170b3583fdee791aa0377973f28f6941ce56 /lib/gitlab_projects.rb | |
parent | 8454d8dc3ae3a5807a95dfd66adefd22d23394f0 (diff) | |
download | gitlab-shell-6a267b32c2a6c100016344c33a175ecc7b0fc924.tar.gz |
Log during failure cases of fork-project.
Diffstat (limited to 'lib/gitlab_projects.rb')
-rw-r--r-- | lib/gitlab_projects.rb | 19 |
1 files changed, 14 insertions, 5 deletions
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)}" |