summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-12-21 11:57:51 +0100
committerDouwe Maan <douwe@gitlab.com>2015-12-21 11:57:51 +0100
commitc910bca730561da3361faec56ef509e25a798c66 (patch)
tree564b719803088c14cf168b0723da1016e0e4474a /app/controllers/projects
parentc65243427f4c940aab35cc86e039c89c6264cf00 (diff)
downloadgitlab-ce-c910bca730561da3361faec56ef509e25a798c66.tar.gz
Add tests for new functionality
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/forks_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb
index 1d599b6c427..750181f0c19 100644
--- a/app/controllers/projects/forks_controller.rb
+++ b/app/controllers/projects/forks_controller.rb
@@ -10,7 +10,11 @@ class Projects::ForksController < Projects::ApplicationController
def create
namespace = Namespace.find(params[:namespace_key])
- @forked_project = ::Projects::ForkService.new(project, current_user, namespace: namespace).execute
+
+ @forked_project = namespace.projects.find_by(path: project.path)
+ @forked_project = nil unless @forked_project && @forked_project.forked_from_project == project
+
+ @forked_project ||= ::Projects::ForkService.new(project, current_user, namespace: namespace).execute
if @forked_project.saved? && @forked_project.forked?
if @forked_project.import_in_progress?