Batch push webhook changed-path lookups into one Gitaly call

What does this MR do and why?

Gitlab::DataBuilder::Push.build previously issued one CommitDelta RPC per commit (up to 20 per branch) to compute the push webhook/integration payload's per-commit added/modified/removed file lists. On pushes updating many branches at once this multiplied into thousands of Gitaly calls — a production Repositories::PostReceiveWorker job showed ~2207 Gitaly calls dominated by CommitDelta.

This MR batches the changed-path lookup via FindChangedPaths:

  • Non-merge commits use a single batched find_changed_paths(commits, find_renames: false) call, with results grouped by commit_id.
  • Merge commits use a per-merge find_changed_paths against a DiffTree of the first parent, preserving the legacy first-parent diff semantics (Gitaly returns a blank commit_id for tree requests, so these are associated manually).
  • The per-commit N+1 and its allow_n_plus_1_calls guard are removed.

On typical pushes this reduces the Gitaly call count from N + M to 1 + M (N non-merge, M merge commits).

Payload note: with find_renames: false, a pure rename now reports the old path under removed and the new path under added (previously added only). This is additive with no data loss; the webhook docs are updated accordingly.

References

Closes #19600 (closed)

How to set up and validate locally

  1. Use a project with an active webhook or integration on push events.
  2. Push a branch containing several commits (and at least one merge commit).
  3. Observe the Gitaly call count for the Repositories::PostReceiveWorker job / Gitlab::DataBuilder::Push.build: CommitDelta calls are replaced by a single FindChangedPaths call for non-merge commits (plus one per merge commit).
  4. Confirm the webhook payload's per-commit added/modified/removed lists are unchanged for non-merge and merge commits (merge commits diff against the first parent).

MR acceptance checklist

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

Merge request reports

Loading