Make GitHooksService#execute return block value

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_21627207
This commit is contained in:
Lin Jen-Shin 2017-01-26 19:35:19 +08:00
parent 9bb4cd75ad
commit 05f4e48a4c
2 changed files with 4 additions and 8 deletions

View File

@ -18,9 +18,9 @@ class GitHooksService
end
end
yield self
run_hook('post-receive')
yield(self).tap do
run_hook('post-receive')
end
end
private

View File

@ -107,8 +107,6 @@ class GitOperationService
end
def with_hooks(ref, newrev, oldrev)
result = nil
GitHooksService.new.execute(
user,
repository.path_to_repo,
@ -116,10 +114,8 @@ class GitOperationService
newrev,
ref) do |service|
result = yield(service) if block_given?
yield(service)
end
result
end
def update_ref(ref, newrev, oldrev)