Merge changes I5366437a,I995954fb,I582e5fcb
* changes: Stop using JGit's deprecated AnyObjectId.equals method UploadArchive: Use PacketLineIn.isEnd helper method Merge branch 'stable-3.0'
This commit is contained in:
commit
88340e629d
@ -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() {
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -314,12 +314,12 @@ public class PatchListLoader implements Callable<PatchList> {
|
||||
}
|
||||
|
||||
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<String> getTouchedFilePaths(PatchListEntry patchListEntry) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user