diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/services/git/branch_hooks_service.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/services/git/branch_hooks_service.rb b/app/services/git/branch_hooks_service.rb index 4aee48f22e7..c41f445c3c4 100644 --- a/app/services/git/branch_hooks_service.rb +++ b/app/services/git/branch_hooks_service.rb @@ -105,8 +105,14 @@ module Git CreateGpgSignatureWorker.perform_async(signable, project.id) end + # It's not sufficient to just check for a blank SHA as it's possible for the + # branch to be pushed, but for the `post-receive` hook to never run: + # https://gitlab.com/gitlab-org/gitlab-ce/issues/59257 def creating_branch? - Gitlab::Git.blank_ref?(params[:oldrev]) + strong_memoize(:creating_branch) do + Gitlab::Git.blank_ref?(params[:oldrev]) || + !project.repository.branch_exists?(branch_name) + end end def updating_branch? |