Comment the LocalDiskRepositoryManager in ApplyObject The LocalDiskRepositoryManager is required specifically for the ApplyObject for skipping any wrapper checks like the multi-site one. Add a specific comment to highlight the exception to the general injection rule of using interfaces instead of implementations. Change-Id: Id1bfb67de427b1dd2261d15dccf867f9065e5f68
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/fetch/ApplyObject.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/fetch/ApplyObject.java index da63168..03362bf 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/fetch/ApplyObject.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/fetch/ApplyObject.java
@@ -15,7 +15,6 @@ package com.googlesource.gerrit.plugins.replication.pull.fetch; import com.google.gerrit.entities.Project; -import com.google.gerrit.server.git.GitRepositoryManager; import com.google.gerrit.server.git.LocalDiskRepositoryManager; import com.google.inject.Inject; import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionData; @@ -31,8 +30,12 @@ public class ApplyObject { - private final GitRepositoryManager gitManager; + private final LocalDiskRepositoryManager gitManager; + // NOTE: We do need specifically the LocalDiskRepositoryManager to make sure + // to be able to write onto the directly physical repository without any wrapper. + // Using for instance the multi-site wrapper injected by Guice would result + // in a split-brain because of the misalignment of local vs. global refs values. @Inject public ApplyObject(LocalDiskRepositoryManager gitManager) { this.gitManager = gitManager;