Fix getRefsByPrefix usage Ie1b9ebd194a4ca2542d9aaf5c59c71dfbb361676 removed usage of the deprecated getRefs(PREFIX) API, but missed that the returned key was being used and the key had the prefix removed. Get ls-batches working correctly again by stripping the prefix from the returned Ref. Change-Id: I86784fdeb3a39e6d4ad44a75dcb57dd14c91db18
diff --git a/src/main/java/com/googlesource/gerrit/plugins/batch/BatchStore.java b/src/main/java/com/googlesource/gerrit/plugins/batch/BatchStore.java index 9c0db7b..d582af4 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/batch/BatchStore.java +++ b/src/main/java/com/googlesource/gerrit/plugins/batch/BatchStore.java
@@ -62,8 +62,9 @@ List<Batch> batches = new ArrayList<>(); try (Repository repo = repoManager.openRepository(project)) { for (Ref ref : repo.getRefDatabase().getRefsByPrefix(BATCHES_REF)) { + String id = ref.getName().substring(BATCHES_REF.length()); try { - batches.add((includeBatchInfo == true) ? read(ref.getName()) : new Batch(ref.getName())); + batches.add((includeBatchInfo == true) ? read(id) : new Batch(id)); } catch (NoSuchBatchException e) { continue; }