Class: Commits::CreateService
- Inherits:
-
BaseService
- Object
- BaseService
- Commits::CreateService
- Defined in:
- app/services/commits/create_service.rb
Direct Known Subclasses
ChangeService, CommitPatchService, Files::BaseService, Submodules::UpdateService
Defined Under Namespace
Classes: ChangeError
Constant Summary collapse
- ValidationError =
Class.new(StandardError)
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(*args) ⇒ CreateService
constructor
A new instance of CreateService.
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(*args) ⇒ CreateService
Returns a new instance of CreateService.
16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/commits/create_service.rb', line 16 def initialize(*args) super @start_project = params[:start_project] || @project @start_branch = params[:start_branch] @start_sha = params[:start_sha] @branch_name = params[:branch_name] @force = params[:force] || false @dry_run = params[:dry_run] || false end |
Instance Method Details
#execute ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/services/commits/create_service.rb', line 27 def execute validate! new_commit = create_commit! success(result: new_commit) rescue ChangeError => ex Gitlab::ErrorTracking.log_exception(ex) error(ex., pass_back: { error_code: ex.error_code }) rescue ValidationError, Gitlab::Git::Index::IndexError, Gitlab::Git::CommitError, Gitlab::Git::PreReceiveError, Gitlab::Git::CommandError => ex Gitlab::ErrorTracking.log_exception(ex) error(Gitlab::EncodingHelper.encode_utf8_no_detect(ex.)) end |