Accept remotes without `fetch` option on primary

The primary replication node only uses `apiUrl` to communicate with
secondary nodes. This means that remote confiugrations without the `url`
and `fetch` options should be valid.

The `remote.<name>.url` is already considered not-required option on the
primary.

With this change, the remote configurations on the primary node without
`fetch` option will also be considered valid.

Bug: Issue 40015281
Change-Id: I701dd82481b28b9a051f97b2a461ebf9b96b0025
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/SourceConfigParser.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/SourceConfigParser.java
index d7ae063..67ac6f1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/SourceConfigParser.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/SourceConfigParser.java
@@ -79,14 +79,14 @@
     return sourceConfigs.build();
   }
 
-  private static List<RemoteConfig> allFetchRemotes(Config cfg) throws ConfigInvalidException {
+  private List<RemoteConfig> allFetchRemotes(Config cfg) throws ConfigInvalidException {
 
     Set<String> names = cfg.getSubsections("remote");
     List<RemoteConfig> result = Lists.newArrayListWithCapacity(names.size());
     for (String name : names) {
       try {
         final RemoteConfig remoteConfig = new RemoteConfig(cfg, name);
-        if (!remoteConfig.getFetchRefSpecs().isEmpty()) {
+        if (!isReplica || !remoteConfig.getFetchRefSpecs().isEmpty()) {
           result.add(remoteConfig);
         } else {
           logger.atFine().log(
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index 99d8b78..a934dfb 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -439,6 +439,10 @@
 	when `replicatePermissions` is true, even if the push refspec
 	is 'all refs'.
 
+>  NOTE: When using the pull-replication and replication plugins together,
+>  **NOT having** a `fetch` configuration for a remote, will also enable
+>  the standard _push_ replication for that remote.
+
 [2]: #example_file
 
 remote.NAME.timeout