Allow push mirrors to disable the "delete diverged refs" behavior
This will resolve limitation number 1 from gitlab#198270:
Push mirroring will delete anything in the destination that isn't in the source. This means we can't create the
auto-deploy
branch solely on Security, as Canonical's push mirror will attempt to delete it. If the branch is protected the mirroring will be blocked entirely; if it's unprotected it gets deleted.
Proposal
This will require an additional field in the UpdateRemoteMirrorRequest
protocol. Something like keep_diverged_refs
, which defaults to false
since it's the current behavior.
When enabled, we won't perform the delete_refs
calls for branches or tags.
This doesn't need to be behind a Gitaly Ruby feature flag, because it will be part of the protocol and default to the current behavior. The gitlab-rails side to allow enabling the functionality will be behind a feature flag.