diff --git a/java/com/google/gerrit/acceptance/GerritServer.java b/java/com/google/gerrit/acceptance/GerritServer.java index a48a278f71..ea63d737e2 100644 --- a/java/com/google/gerrit/acceptance/GerritServer.java +++ b/java/com/google/gerrit/acceptance/GerritServer.java @@ -259,6 +259,8 @@ public class GerritServer implements AutoCloseable { // Silence non-critical messages from JGit. .put("org.eclipse.jgit.transport.PacketLineIn", Level.WARN) .put("org.eclipse.jgit.transport.PacketLineOut", Level.WARN) + .put("org.eclipse.jgit.internal.storage.file.FileSnapshot", Level.WARN) + .put("org.eclipse.jgit.util.FS", Level.WARN) .build(); private static boolean forceLocalDisk() { 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/edit/tree/ChangeFileContentModification.java b/java/com/google/gerrit/server/edit/tree/ChangeFileContentModification.java index d91e2e8420..0adacd8461 100644 --- a/java/com/google/gerrit/server/edit/tree/ChangeFileContentModification.java +++ b/java/com/google/gerrit/server/edit/tree/ChangeFileContentModification.java @@ -23,6 +23,7 @@ import com.google.common.io.ByteStreams; import com.google.gerrit.extensions.restapi.RawInput; import java.io.IOException; import java.io.InputStream; +import java.time.Instant; import java.util.Collections; import java.util.List; import org.eclipse.jgit.dircache.DirCacheEditor; @@ -79,7 +80,7 @@ public class ChangeFileContentModification implements TreeModification { try { if (dirCacheEntry.getFileMode() == FileMode.GITLINK) { dirCacheEntry.setLength(0); - dirCacheEntry.setLastModified(0); + dirCacheEntry.setLastModified(Instant.EPOCH); ObjectId newObjectId = ObjectId.fromString(getNewContentBytes(), 0); dirCacheEntry.setObjectId(newObjectId); } else { 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) { diff --git a/java/com/google/gerrit/sshd/commands/UploadArchive.java b/java/com/google/gerrit/sshd/commands/UploadArchive.java index a58e472d10..c25a1a8f66 100644 --- a/java/com/google/gerrit/sshd/commands/UploadArchive.java +++ b/java/com/google/gerrit/sshd/commands/UploadArchive.java @@ -139,7 +139,7 @@ public class UploadArchive extends AbstractGitCommand { PacketLineIn packetIn = new PacketLineIn(in); for (; ; ) { String s = packetIn.readString(); - if (isPacketLineEnd(s)) { + if (PacketLineIn.isEnd(s)) { break; } if (!s.startsWith(argCmd)) { @@ -163,12 +163,6 @@ public class UploadArchive extends AbstractGitCommand { } } - // JGit API depends on reference equality with sentinel. - @SuppressWarnings({"ReferenceEquality", "StringEquality"}) - private static boolean isPacketLineEnd(String s) { - return s == PacketLineIn.END; - } - @Override protected void runImpl() throws IOException, PermissionBackendException, Failure { PacketLineOut packetOut = new PacketLineOut(out);