diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-04-01 10:33:23 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-04-01 10:33:23 +0300 |
commit | 95b84e2c5aa92a5a8effc108fdbdf596dff4818c (patch) | |
tree | 0ee296ccfd9ef9cc2157a4915ebee2ddfaa8bdb1 /app/services/create_branch_service.rb | |
parent | 8f3701eff005aeedcebff8ce02074f5056a369b3 (diff) | |
download | gitlab-ce-95b84e2c5aa92a5a8effc108fdbdf596dff4818c.tar.gz |
Move branch creation logic in service
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/services/create_branch_service.rb')
-rw-r--r-- | app/services/create_branch_service.rb | 13 |
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 |