Adapt to the simplified GitReferenceUpdatedListener.Event API
Change-Id: Ib8c2e91d0d2fd4307a8bfc1233ee21a13cb9bf61
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/RefUpdateListener.java b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/RefUpdateListener.java
index d3efd87..cd85f7d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/RefUpdateListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/RefUpdateListener.java
@@ -119,16 +119,13 @@
try {
CreateReviewNotes crn = reviewNotesFactory.create(
reviewDb, projectName, git);
- for (Update u : e.getUpdates()) {
- if (!u.getRefName().startsWith("refs/heads/")) {
- continue;
- }
- crn.createNotes(u.getRefName(),
- ObjectId.fromString(u.getOldObjectId()),
- ObjectId.fromString(u.getNewObjectId()),
+ if (e.getRefName().startsWith("refs/heads/")) {
+ crn.createNotes(e.getRefName(),
+ ObjectId.fromString(e.getOldObjectId()),
+ ObjectId.fromString(e.getNewObjectId()),
null);
+ crn.commitNotes();
}
- crn.commitNotes();
} catch (OrmException x) {
log.error(x.getMessage(), x);
} catch (IOException x) {