diff options
author | Valery Sizov <valery@gitlab.com> | 2016-07-04 15:30:22 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2016-07-04 15:31:49 +0300 |
commit | bf218337ed5bd535856204ef1878a1495fa37dfe (patch) | |
tree | 66415495c994a17fb0c45bcfcb4a3d08d808098f /app | |
parent | 021b6aef94b3398ab5603b4c11afd4c6d8432795 (diff) | |
download | gitlab-ce-bf218337ed5bd535856204ef1878a1495fa37dfe.tar.gz |
Better message for git hooks and file locks
Diffstat (limited to 'app')
-rw-r--r-- | app/services/create_branch_service.rb | 4 | ||||
-rw-r--r-- | app/services/create_tag_service.rb | 4 | ||||
-rw-r--r-- | app/services/delete_branch_service.rb | 4 | ||||
-rw-r--r-- | app/services/git_hooks_service.rb | 6 |
4 files changed, 10 insertions, 8 deletions
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb index 9f4481a8153..cc128563437 100644 --- a/app/services/create_branch_service.rb +++ b/app/services/create_branch_service.rb @@ -34,8 +34,8 @@ class CreateBranchService < BaseService else error('Invalid reference name') end - rescue GitHooksService::PreReceiveError - error('Branch creation was rejected by Git hook') + rescue GitHooksService::PreReceiveError => ex + error(ex.message) end def success(branch) diff --git a/app/services/create_tag_service.rb b/app/services/create_tag_service.rb index 91ed0e354d0..bd8d982e1fb 100644 --- a/app/services/create_tag_service.rb +++ b/app/services/create_tag_service.rb @@ -13,8 +13,8 @@ class CreateTagService < BaseService new_tag = repository.add_tag(current_user, tag_name, target, message) rescue Rugged::TagError return error("Tag #{tag_name} already exists") - rescue GitHooksService::PreReceiveError - return error('Tag creation was rejected by Git hook') + rescue GitHooksService::PreReceiveError => ex + return error(ex.message) end if new_tag diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb index fae069ee4a5..752a7029952 100644 --- a/app/services/delete_branch_service.rb +++ b/app/services/delete_branch_service.rb @@ -30,8 +30,8 @@ class DeleteBranchService < BaseService else error('Failed to remove branch') end - rescue GitHooksService::PreReceiveError - error('Branch deletion was rejected by Git hook') + rescue GitHooksService::PreReceiveError => ex + error(ex.message) end def error(message, return_code = 400) diff --git a/app/services/git_hooks_service.rb b/app/services/git_hooks_service.rb index d7a0c25a044..172bd85dade 100644 --- a/app/services/git_hooks_service.rb +++ b/app/services/git_hooks_service.rb @@ -9,8 +9,10 @@ class GitHooksService @ref = ref %w(pre-receive update).each do |hook_name| - unless run_hook(hook_name) - raise PreReceiveError.new("Git operation was rejected by #{hook_name} hook") + status, message = run_hook(hook_name) + + unless status + raise PreReceiveError, message end end |