Allow refs filtering for non-delta fetches

Change I19d58638 introduced the ability to filter out refs from the
fetch-replication deltas. That is, the pull-replication plugin could
delegate other plugins to influence which refs should be fetched from
the remote source.

This mechanism however, was not working when receiving a request to
fetch from a source, without an explicit list of refs (for example via
the `pull-replication start` SSH command).

In this case the pull-replication was blindly fetching all matching refs
from the source.

When fetching from source without any explicit refs (i.e. no delta),
compare the remote refs that match the configured refSpecs against the
local refs and select only the ones needing to be created or updated.

The resulting list can then be passed on, as for the delta-case, to the
provided fetch-filter implementation.

In a multi-site setup, this allows to check the resulting refs against
the global-refdb so that no already-in-sync refs are fetched (details on
such implementation can be found at If60f5f5ea).

Note that this change does nothing to validate fetching of refs that do
not currently exist locally or that have been removed from the remote.

These concerns are captured as separate issues in [1] and [2],
respectively.

[1] https://issues.gerritcodereview.com/issues/316844804
[2] https://issues.gerritcodereview.com/issues/316844806

Bug: Issue 40014518
Change-Id: I29507376e9e4339d8a0517fcabd566014963a8ad
4 files changed
tree: 5a39cff0b74998c87409a8842b7b973a6f95e2ee
  1. example-setup/
  2. src/
  3. .gitignore
  4. BUILD
  5. Jenkinsfile
  6. LICENSE