diff options
author | Rémy Coutable <remy@rymai.me> | 2019-06-18 18:20:33 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-06-18 18:20:33 +0300 |
commit | 0eae158c15eb047a58a3f51db0c32f1b841b4b60 (patch) | |
tree | ce01e8e7efa4c3f336ff9f856918932cffa175ab /app | |
parent | cd17f804d51751870f71e3bab57feeb9ab75da38 (diff) | |
parent | b2c73fde791ebac6c2cc615fce19294190b05609 (diff) |
Merge branch '59257-find-new-branches-harder' into 'master'
Look for new branches more carefully
Closes #59257
See merge request gitlab-org/gitlab-ce!29761
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? |