Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-11-14 20:41:14 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-11-14 20:41:14 +0300
commit3128641f7eb93fec0930ebfb83a93dfa5e0b343a (patch)
tree4dee0efc686a75ff904ba3fa921bb181ac740212
parentf5bc41b3861c8951ff54ec360b450ec99228776b (diff)
Revert "Don't execute git hooks if you create branch as part of other change"
This reverts commit a431ca0f8b7f8967e89a35caddf1e41e53eee290.
-rw-r--r--app/models/repository.rb8
-rw-r--r--app/services/commits/change_service.rb2
-rw-r--r--app/services/create_branch_service.rb4
-rw-r--r--app/services/files/base_service.rb2
4 files changed, 6 insertions, 10 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index feaaacd02a9..063dc74021d 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -162,18 +162,14 @@ class Repository
tags.find { |tag| tag.name == name }
end
- def add_branch(user, branch_name, target, with_hooks: true)
+ def add_branch(user, branch_name, target)
oldrev = Gitlab::Git::BLANK_SHA
ref = Gitlab::Git::BRANCH_REF_PREFIX + branch_name
target = commit(target).try(:id)
return false unless target
- if with_hooks
- GitHooksService.new.execute(user, path_to_repo, oldrev, target, ref) do
- update_ref!(ref, target, oldrev)
- end
- else
+ GitHooksService.new.execute(user, path_to_repo, oldrev, target, ref) do
update_ref!(ref, target, oldrev)
end
diff --git a/app/services/commits/change_service.rb b/app/services/commits/change_service.rb
index 2d4c9788d02..1c82599c579 100644
--- a/app/services/commits/change_service.rb
+++ b/app/services/commits/change_service.rb
@@ -55,7 +55,7 @@ module Commits
return success if repository.find_branch(new_branch)
result = CreateBranchService.new(@project, current_user)
- .execute(new_branch, @target_branch, source_project: @source_project, with_hooks: false)
+ .execute(new_branch, @target_branch, source_project: @source_project)
if result[:status] == :error
raise ChangeError, "There was an error creating the source branch: #{result[:message]}"
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb
index a6a3461e17b..757fc35a78f 100644
--- a/app/services/create_branch_service.rb
+++ b/app/services/create_branch_service.rb
@@ -1,7 +1,7 @@
require_relative 'base_service'
class CreateBranchService < BaseService
- def execute(branch_name, ref, source_project: @project, with_hooks: true)
+ def execute(branch_name, ref, source_project: @project)
valid_branch = Gitlab::GitRefValidator.validate(branch_name)
unless valid_branch
@@ -26,7 +26,7 @@ class CreateBranchService < BaseService
repository.find_branch(branch_name)
else
- repository.add_branch(current_user, branch_name, ref, with_hooks: with_hooks)
+ repository.add_branch(current_user, branch_name, ref)
end
if new_branch
diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb
index 1802b932e03..9bd4bd464f7 100644
--- a/app/services/files/base_service.rb
+++ b/app/services/files/base_service.rb
@@ -74,7 +74,7 @@ module Files
end
def create_target_branch
- result = CreateBranchService.new(project, current_user).execute(@target_branch, @source_branch, source_project: @source_project, with_hooks: false)
+ result = CreateBranchService.new(project, current_user).execute(@target_branch, @source_branch, source_project: @source_project)
unless result[:status] == :success
raise_error("Something went wrong when we tried to create #{@target_branch} for you: #{result[:message]}")