Skip to content

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

What does this MR do?

Currently, our procedure for adding a commit requires us to execute CreateBranchService before file creation. It's OK, but also we do execute git hooks (the PostReceive sidekiq job) as part of this process. However, this hook is execute before the file is actually committed, so the ref is updated.

Secondly, we do execute a git hooks after committing file and updating ref. This results in duplicate PostReceive jobs, where the first one is completely invalid.

This change makes the branch creation, something that is intermediate step of bigger process (file creation or update, commit cherry pick or revert) to not execute git hooks.

Why was this MR needed?

Adds a to CreateBranchService an option to disable hooks execution.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/23439

Merge request reports

Loading