Trigger GitReferenceUpdated event when external IDs are updated
When external IDs are updated the refs/meta/external-ids branch in the All-Users repository is updated. For this update we must trigger a GitReferenceUpdated event, so that e.g. this ref update gets replicated to Gerrit slaves. PostGpgKeys and GpgKeys are now injected as provider into GpgApiAdapterImpl to avoid a circular Guice dependency: GitReferenceUpdated needs EventUtil which needs ChangeJson.Factory. ChangeJson uses GpgApiAdapter to find out if push certificates are enabled and if yes to include the push certicates of the patch set uploaders into RevisionInfo. This doesn't require PostGpgKeys and GpgKeys. If PostGpgKeys would be injected without provider we would need ExternalIdsUpdate.User to instantiate it which now needs GitReferenceUpdated. Hence without injecting PostGpgKeys into GpgApiAdapterImpl as a provider we would have a dependency circle. Change-Id: Ia9c71d26669f24f20c659d82ae97ecfca6ab61c3 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -16,11 +16,13 @@ package com.google.gerrit.pgm.init;
|
||||
|
||||
import com.google.gerrit.pgm.init.api.AllUsersNameOnInitProvider;
|
||||
import com.google.gerrit.pgm.init.api.InitFlags;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.GerritPersonIdentProvider;
|
||||
import com.google.gerrit.server.account.externalids.ExternalId;
|
||||
import com.google.gerrit.server.account.externalids.ExternalIdReader;
|
||||
import com.google.gerrit.server.account.externalids.ExternalIdsUpdate;
|
||||
import com.google.gerrit.server.config.SitePaths;
|
||||
import com.google.gerrit.server.extensions.events.GitReferenceUpdated;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.File;
|
||||
@@ -67,7 +69,17 @@ public class ExternalIdsOnInit {
|
||||
|
||||
PersonIdent serverIdent = new GerritPersonIdentProvider(flags.cfg).get();
|
||||
ExternalIdsUpdate.commit(
|
||||
repo, rw, ins, rev, noteMap, commitMessage, serverIdent, serverIdent);
|
||||
new Project.NameKey(allUsers),
|
||||
repo,
|
||||
rw,
|
||||
ins,
|
||||
rev,
|
||||
noteMap,
|
||||
commitMessage,
|
||||
serverIdent,
|
||||
serverIdent,
|
||||
null,
|
||||
GitReferenceUpdated.DISABLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user