diff options
Diffstat (limited to 'lib/gitlab_projects.rb')
-rw-r--r-- | lib/gitlab_projects.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index aef343e..3115868 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -29,6 +29,7 @@ class GitlabProjects when 'rm-project'; rm_project when 'mv-project'; mv_project when 'import-project'; import_project + when 'fork-project'; fork_project else puts 'not allowed' false @@ -84,4 +85,16 @@ class GitlabProjects FileUtils.mv(full_path, new_full_path) end + + def fork_project + new_namespace = ARGV.shift + + return false unless new_namespace + + namespaced_path = File.join(repos_path, new_namespace) + return false unless File.exists?(namespaced_path) + + cmd = "cd #{namespaced_path} && git clone --bare #{@full_path}" + system(cmd) + end end |