diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-14 16:23:40 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-14 16:23:40 +0200 |
commit | f4149bcddca9c0e7aac078b3e7c198f5624ea107 (patch) | |
tree | a0315fdea9e31d2694768d08c94b6361a405dccd /app/services/files | |
parent | 4e4866f2559262b3c858de15890eb864f18eeca8 (diff) | |
download | gitlab-ce-f4149bcddca9c0e7aac078b3e7c198f5624ea107.tar.gz |
Refactor how repository makes commit with pre/post receive hooks
Diffstat (limited to 'app/services/files')
-rw-r--r-- | app/services/files/base_service.rb | 2 | ||||
-rw-r--r-- | app/services/files/create_service.rb | 4 | ||||
-rw-r--r-- | app/services/files/delete_service.rb | 4 | ||||
-rw-r--r-- | app/services/files/update_service.rb | 4 |
4 files changed, 4 insertions, 10 deletions
diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb index 507e21f5818..7aecee217d8 100644 --- a/app/services/files/base_service.rb +++ b/app/services/files/base_service.rb @@ -26,7 +26,7 @@ module Files else error("Something went wrong. Your changes were not committed") end - rescue CommitService::CommitError, CommitService::PreReceiveError, ValidationError => ex + rescue Repository::CommitError, Repository::PreReceiveError, ValidationError => ex error(ex.message) end diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb index 3e00864f00d..91d715b2d63 100644 --- a/app/services/files/create_service.rb +++ b/app/services/files/create_service.rb @@ -3,9 +3,7 @@ require_relative "base_service" module Files class CreateService < Files::BaseService def commit - CommitService.transaction(project, current_user, @target_branch) do |tmp_ref| - repository.commit_file(current_user, @file_path, @file_content, @commit_message, tmp_ref) - end + repository.commit_file(current_user, @file_path, @file_content, @commit_message, @target_branch) end def validate diff --git a/app/services/files/delete_service.rb b/app/services/files/delete_service.rb index d61ca31cf9d..27c881c3430 100644 --- a/app/services/files/delete_service.rb +++ b/app/services/files/delete_service.rb @@ -3,9 +3,7 @@ require_relative "base_service" module Files class DeleteService < Files::BaseService def commit - CommitService.transaction(project, current_user, @target_branch) do |tmp_ref| - repository.remove_file(current_user, @file_path, @commit_message, tmp_ref) - end + repository.remove_file(current_user, @file_path, @commit_message, @target_branch) end end end diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb index 69212b36996..a20903c6f02 100644 --- a/app/services/files/update_service.rb +++ b/app/services/files/update_service.rb @@ -3,9 +3,7 @@ require_relative "base_service" module Files class UpdateService < Files::BaseService def commit - CommitService.transaction(project, current_user, @target_branch) do |tmp_ref| - repository.commit_file(current_user, @file_path, @file_content, @commit_message, tmp_ref) - end + repository.commit_file(current_user, @file_path, @file_content, @commit_message, @target_branch) end end end |