From 95c89ec8a04a97ab651676655d2463bef17786cb Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 6 Sep 2019 12:09:37 +0900 Subject: [PATCH] Stop using JGit's deprecated AnyObjectId.equals method The equals method was depecated in favor of isEqual in [1] which is included in JGit since version v5.4.1.201908211225-r. [1] https://git.eclipse.org/r/#/c/147315/ Change-Id: I5366437a04a75135fcd522e65b80be5a34d7c334 --- java/com/google/gerrit/server/edit/ChangeEditModifier.java | 4 ++-- java/com/google/gerrit/server/patch/PatchListLoader.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/java/com/google/gerrit/server/edit/ChangeEditModifier.java b/java/com/google/gerrit/server/edit/ChangeEditModifier.java index fcd38c3435..661e376299 100644 --- a/java/com/google/gerrit/server/edit/ChangeEditModifier.java +++ b/java/com/google/gerrit/server/edit/ChangeEditModifier.java @@ -371,7 +371,7 @@ public class ChangeEditModifier { if (optionalChangeEdit.isPresent()) { ChangeEdit changeEdit = optionalChangeEdit.get(); newTreeId = merge(repository, changeEdit, newTreeId); - if (ObjectId.equals(newTreeId, changeEdit.getEditCommit().getTree())) { + if (ObjectId.isEqual(newTreeId, changeEdit.getEditCommit().getTree())) { // Modifications are already contained in the change edit. return changeEdit; } @@ -474,7 +474,7 @@ public class ChangeEditModifier { treeCreator.addTreeModifications(treeModifications); ObjectId newTreeId = treeCreator.createNewTreeAndGetId(repository); - if (ObjectId.equals(newTreeId, baseCommit.getTree())) { + if (ObjectId.isEqual(newTreeId, baseCommit.getTree())) { throw new InvalidChangeOperationException("no changes were made"); } return newTreeId; diff --git a/java/com/google/gerrit/server/patch/PatchListLoader.java b/java/com/google/gerrit/server/patch/PatchListLoader.java index 08de537305..b639f96327 100644 --- a/java/com/google/gerrit/server/patch/PatchListLoader.java +++ b/java/com/google/gerrit/server/patch/PatchListLoader.java @@ -314,12 +314,12 @@ public class PatchListLoader implements Callable { } private static boolean areParentChild(RevCommit commitA, RevCommit commitB) { - return ObjectId.equals(commitA.getParent(0), commitB) - || ObjectId.equals(commitB.getParent(0), commitA); + return ObjectId.isEqual(commitA.getParent(0), commitB) + || ObjectId.isEqual(commitB.getParent(0), commitA); } private static boolean haveCommonParent(RevCommit commitA, RevCommit commitB) { - return ObjectId.equals(commitA.getParent(0), commitB.getParent(0)); + return ObjectId.isEqual(commitA.getParent(0), commitB.getParent(0)); } private static Set getTouchedFilePaths(PatchListEntry patchListEntry) {