diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-11-02 11:39:12 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-11-02 11:39:12 +0100 |
commit | a431ca0f8b7f8967e89a35caddf1e41e53eee290 (patch) | |
tree | 61754705d6a313ccd372e6e83c282aa3c084f908 /app/services/files | |
parent | b328c7885532ccff70e1f9f7dc970a8dde0c52d6 (diff) | |
download | gitlab-ce-a431ca0f8b7f8967e89a35caddf1e41e53eee290.tar.gz |
Don't execute git hooks if you create branch as part of other change
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.
Diffstat (limited to 'app/services/files')
-rw-r--r-- | app/services/files/base_service.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb index 9bd4bd464f7..1802b932e03 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) + result = CreateBranchService.new(project, current_user).execute(@target_branch, @source_branch, source_project: @source_project, with_hooks: false) unless result[:status] == :success raise_error("Something went wrong when we tried to create #{@target_branch} for you: #{result[:message]}") |