Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2016-07-18 17:06:49 +0300
committerValery Sizov <valery@gitlab.com>2016-07-19 07:45:22 +0300
commit501ce37f838205cfd588eed47d57ca4a90c68e51 (patch)
tree746957353201e064185b6b76f21a02a79de69170 /app/services/create_branch_service.rb
parenta27212ab908d5161f5a75b27c4616c11f497f5d4 (diff)
Fix of 'Commits being passed to custom hooks are already reachable when using the UI'
Diffstat (limited to 'app/services/create_branch_service.rb')
-rw-r--r--app/services/create_branch_service.rb28
1 files changed, 13 insertions, 15 deletions
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb
index d874582d54f..757fc35a78f 100644
--- a/app/services/create_branch_service.rb
+++ b/app/services/create_branch_service.rb
@@ -15,21 +15,19 @@ class CreateBranchService < BaseService
return error('Branch already exists')
end
- new_branch = nil
-
- if source_project != @project
- repository.with_tmp_ref do |tmp_ref|
- repository.fetch_ref(
- source_project.repository.path_to_repo,
- "refs/heads/#{ref}",
- tmp_ref
- )
-
- new_branch = repository.add_branch(current_user, branch_name, tmp_ref)
- end
- else
- new_branch = repository.add_branch(current_user, branch_name, ref)
- end
+ new_branch = if source_project != @project
+ repository.fetch_ref(
+ source_project.repository.path_to_repo,
+ "refs/heads/#{ref}",
+ "refs/heads/#{branch_name}"
+ )
+
+ repository.after_create_branch
+
+ repository.find_branch(branch_name)
+ else
+ repository.add_branch(current_user, branch_name, ref)
+ end
if new_branch
success(new_branch)