b2c73fde79
In certain cases, GitLab can miss a PostReceive invocation the first time a branch is pushed. When this happens, the "branch created" hooks are not run, which means various features don't work until the branch is deleted and pushed again. This MR changes the `Git::BranchPushService` so it checks the cache of existing branches in addition to the `oldrev` reported for the branch. If the branch name isn't in the cache, chances are we haven't run the service yet (it's what refreshes the cache), so we can go ahead and run it, even through `oldrev` is set. If the cache has been cleared by some other means in the meantime, then we'll still fail to run the hooks when we should. Fixing that in the general case is a larger problem, and we'd need to devote significant engineering effort to it. There's a chance that we'll run the relevant hooks *multiple times* with this change, if there's a race between the branch being created, and the `PostReceive` worker being run multiple times, but this can already happen, since Sidekiq is "at-least-once" execution of jobs. So, this should be safe. |
||
---|---|---|
.. | ||
bin | ||
config | ||
controllers | ||
db | ||
dependencies | ||
factories | ||
features | ||
finders | ||
fixtures | ||
frontend | ||
graphql | ||
haml_lint/linter | ||
helpers | ||
initializers | ||
javascripts | ||
lib | ||
mailers | ||
migrations | ||
models | ||
policies | ||
presenters | ||
rack_servers | ||
requests | ||
routing | ||
rubocop | ||
serializers | ||
services | ||
sidekiq/cron | ||
support | ||
tasks | ||
uploaders | ||
validators | ||
views | ||
workers | ||
factories_spec.rb | ||
fast_spec_helper.rb | ||
rails_helper.rb | ||
rake_helper.rb | ||
simplecov_env.rb | ||
spec_helper.rb |