diff options
author | Douwe Maan <douwe@gitlab.com> | 2019-08-16 19:53:57 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-08-16 19:53:57 +0000 |
commit | b0a230daedd99b5a7b41ddf544c66a6ed57adefc (patch) | |
tree | 3dbeb5f11039722f520694041e6e161d15b628f0 /lib | |
parent | b3145bc976836f4c28a2f97a57e40b9f315aa3a4 (diff) | |
parent | f14647fdae4a07c3c59665576b70f847ab866c58 (diff) | |
download | gitlab-ce-b0a230daedd99b5a7b41ddf544c66a6ed57adefc.tar.gz |
Merge branch 'sh-post-receive-cache-clear-once' into 'master'
Expire project caches once per push instead of once per ref
Closes #52046
See merge request gitlab-org/gitlab-ce!31876
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git_post_receive.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/gitlab/git_post_receive.rb b/lib/gitlab/git_post_receive.rb index 24d752b8a4b..2a8bcd015a8 100644 --- a/lib/gitlab/git_post_receive.rb +++ b/lib/gitlab/git_post_receive.rb @@ -39,6 +39,17 @@ module Gitlab end end + def includes_default_branch? + # If the branch doesn't have a default branch yet, we presume the + # first branch pushed will be the default. + return true unless project.default_branch.present? + + enum_for(:changes_refs).any? do |_oldrev, _newrev, ref| + Gitlab::Git.branch_ref?(ref) && + Gitlab::Git.branch_name(ref) == project.default_branch + end + end + private def deserialize_changes(changes) |