Evict All-Projects after before reading it in a GitRefUpdate The work on the project cache has surfaced an interesting bug. Before this rework, the project cache was disabled in tests, meaning every call to it would reload from disk. Now, it is enabled. This broke the SuperManifest tests because the plugin listens to GitRefUpdated events on All-Projects, refs/meta/config and keeps an internal state of parsed configs. GitRefUpdated hooks are called before ReceiveCommit evicts the project cache in #postUpdate. This commit adds a band-aid to evict All-Projects before reading the confing. This will only be triggered on config updates to All-Projects. It means evicting All-Projects twice on update. Change-Id: I34def3f65bbead56462836e553ae03a0b4c79fa8
diff --git a/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java b/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java index 2f1dfaa..43602ac 100644 --- a/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java +++ b/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java
@@ -238,6 +238,9 @@ if (event.getProjectName().equals(allProjectsName.get())) { if (event.getRefName().equals("refs/meta/config")) { try { + // TODO: Remove, this is just band-aid. + // Evict project cache because this is called before that eviction is done in core + projectCache.evict(allProjectsName); updateConfiguration(); } catch (NoSuchProjectException e) { throw new IllegalStateException(e);