in java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java [289:330]
public void onGitReferenceUpdated(Event event) {
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);
}
}
return;
}
if(RefNames.isNoteDbMetaRef(event.getRefName())) {
// NoteDb meta ref updates never cause supermanifest updates.
return;
}
List<ConfigEntry> relevantConfigs =
findRelevantConfigs(event.getProjectName(), event.getRefName());
for (ConfigEntry relevantConfig : relevantConfigs) {
try {
updateForConfig(relevantConfig, event.getRefName());
} catch (ConfigInvalidException | IOException | GitAPIException e) {
// We only want the trace up to here. We could recurse into the exception, but this at least
// trims the very common jgit.gitrepo.RepoCommand.RemoteUnavailableException.
StackTraceElement here = Thread.currentThread().getStackTrace()[1];
e.setStackTrace(trimStack(e.getStackTrace(), here));
// We are in an asynchronously called listener, so there is no user action to give
// feedback to. We log the error, but it would be nice if we could surface these logs
// somewhere. Perhaps we could store these as commits in some special branch (but in
// what repo?).
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
error(
"update for %s (ref %s) failed: %s", relevantConfig.toString(), event.getRefName(), sw);
}
}
}