Simplify atomic cache/tag clear code in PostReceive

What does this MR do and why?

In !160946 (merged) we added an additional branch/tag cache clear in PostReceive. However, the existing Repository#expire_branches_cache and Repository#expire_tags_cache should probably be performed in the lock for two reasons:

  1. It reduces a duplicate cache clear and some extra methods in Repository.

  2. There is another method (has_ambiguous_refs) that depends on the branch/tag names. This should probably be synchronized.

This does mean the lock will be held slightly longer, but we expect expiring a few more cache keys should not be significant.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

See notes in !160946 (merged).

Edited by Stan Hu

Merge request reports

Loading