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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-01 11:33:23 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-01 11:33:23 +0400
commit95b84e2c5aa92a5a8effc108fdbdf596dff4818c (patch)
tree0ee296ccfd9ef9cc2157a4915ebee2ddfaa8bdb1 /app/services
parent8f3701eff005aeedcebff8ce02074f5056a369b3 (diff)
Move branch creation logic in service
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/services')
-rw-r--r--app/services/create_branch_service.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb
new file mode 100644
index 00000000000..98beeee8354
--- /dev/null
+++ b/app/services/create_branch_service.rb
@@ -0,0 +1,13 @@
+class CreateBranchService
+ def execute(project, branch_name, ref, current_user)
+ repository = project.repository
+ repository.add_branch(branch_name, ref)
+ new_branch = repository.find_branch(branch_name)
+
+ if new_branch
+ Event.create_ref_event(project, current_user, new_branch, 'add')
+ end
+
+ new_branch
+ end
+end