From fe8d24eb99e7943155540fb317a45e97a07446e9 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 13 Jan 2015 02:16:46 +0300 Subject: [PATCH] #446: added comments --- app/models/concerns/git.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/concerns/git.rb b/app/models/concerns/git.rb index d69d0349c..bc7fd55de 100644 --- a/app/models/concerns/git.rb +++ b/app/models/concerns/git.rb @@ -152,16 +152,22 @@ module Git end end + # Creates fork/alias for GIT repo def fork_git_repo dummy = Grit::Repo.new(path) rescue nil + # Do nothing if GIT repo already exist unless dummy if alias_from_id aliases_path = File.join(APP_CONFIG['git_path'], 'git_projects', '.aliases') FileUtils.mkdir_p(aliases_path) alias_path = File.join(aliases_path, "#{alias_from_id}.git") if !Dir.exists?(alias_path) && alias_from + # Move GIT repo into aliases FileUtils.mv(alias_from.path, alias_path, force: true) + # Create link for GIT + FileUtils.ln_sf alias_path, alias_from.path end + # Create link for GIT FileUtils.ln_sf alias_path, path else parent.repo.fork_bare(path, shared: false)