Skip to content
Snippets Groups Projects

Don't execute git hooks if you create branch as part of other change

Merged Kamil Trzciński requested to merge fix-git-hooks-when-creating-file into master
All threads resolved!
Compare and
5 files
+ 25
20
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 6
2
@@ -160,14 +160,18 @@ def find_tag(name)
tags.find { |tag| tag.name == name }
end
def add_branch(user, branch_name, target)
def add_branch(user, branch_name, target, with_hooks: true)
oldrev = Gitlab::Git::BLANK_SHA
ref = Gitlab::Git::BRANCH_REF_PREFIX + branch_name
target = commit(target).try(:id)
return false unless target
GitHooksService.new.execute(user, path_to_repo, oldrev, target, ref) do
if with_hooks
GitHooksService.new.execute(user, path_to_repo, oldrev, target, ref) do
update_ref!(ref, target, oldrev)
end
else
update_ref!(ref, target, oldrev)
end
Loading