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.
|
// Silence non-critical messages from JGit.
|
||||||
.put("org.eclipse.jgit.transport.PacketLineIn", Level.WARN)
|
.put("org.eclipse.jgit.transport.PacketLineIn", Level.WARN)
|
||||||
.put("org.eclipse.jgit.transport.PacketLineOut", 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();
|
.build();
|
||||||
|
|
||||||
private static boolean forceLocalDisk() {
|
private static boolean forceLocalDisk() {
|
||||||
|
@ -371,7 +371,7 @@ public class ChangeEditModifier {
|
|||||||
if (optionalChangeEdit.isPresent()) {
|
if (optionalChangeEdit.isPresent()) {
|
||||||
ChangeEdit changeEdit = optionalChangeEdit.get();
|
ChangeEdit changeEdit = optionalChangeEdit.get();
|
||||||
newTreeId = merge(repository, changeEdit, newTreeId);
|
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.
|
// Modifications are already contained in the change edit.
|
||||||
return changeEdit;
|
return changeEdit;
|
||||||
}
|
}
|
||||||
@ -474,7 +474,7 @@ public class ChangeEditModifier {
|
|||||||
treeCreator.addTreeModifications(treeModifications);
|
treeCreator.addTreeModifications(treeModifications);
|
||||||
ObjectId newTreeId = treeCreator.createNewTreeAndGetId(repository);
|
ObjectId newTreeId = treeCreator.createNewTreeAndGetId(repository);
|
||||||
|
|
||||||
if (ObjectId.equals(newTreeId, baseCommit.getTree())) {
|
if (ObjectId.isEqual(newTreeId, baseCommit.getTree())) {
|
||||||
throw new InvalidChangeOperationException("no changes were made");
|
throw new InvalidChangeOperationException("no changes were made");
|
||||||
}
|
}
|
||||||
return newTreeId;
|
return newTreeId;
|
||||||
|
@ -23,6 +23,7 @@ import com.google.common.io.ByteStreams;
|
|||||||
import com.google.gerrit.extensions.restapi.RawInput;
|
import com.google.gerrit.extensions.restapi.RawInput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.eclipse.jgit.dircache.DirCacheEditor;
|
import org.eclipse.jgit.dircache.DirCacheEditor;
|
||||||
@ -79,7 +80,7 @@ public class ChangeFileContentModification implements TreeModification {
|
|||||||
try {
|
try {
|
||||||
if (dirCacheEntry.getFileMode() == FileMode.GITLINK) {
|
if (dirCacheEntry.getFileMode() == FileMode.GITLINK) {
|
||||||
dirCacheEntry.setLength(0);
|
dirCacheEntry.setLength(0);
|
||||||
dirCacheEntry.setLastModified(0);
|
dirCacheEntry.setLastModified(Instant.EPOCH);
|
||||||
ObjectId newObjectId = ObjectId.fromString(getNewContentBytes(), 0);
|
ObjectId newObjectId = ObjectId.fromString(getNewContentBytes(), 0);
|
||||||
dirCacheEntry.setObjectId(newObjectId);
|
dirCacheEntry.setObjectId(newObjectId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -314,12 +314,12 @@ public class PatchListLoader implements Callable<PatchList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean areParentChild(RevCommit commitA, RevCommit commitB) {
|
private static boolean areParentChild(RevCommit commitA, RevCommit commitB) {
|
||||||
return ObjectId.equals(commitA.getParent(0), commitB)
|
return ObjectId.isEqual(commitA.getParent(0), commitB)
|
||||||
|| ObjectId.equals(commitB.getParent(0), commitA);
|
|| ObjectId.isEqual(commitB.getParent(0), commitA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean haveCommonParent(RevCommit commitA, RevCommit commitB) {
|
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) {
|
private static Set<String> getTouchedFilePaths(PatchListEntry patchListEntry) {
|
||||||
|
@ -139,7 +139,7 @@ public class UploadArchive extends AbstractGitCommand {
|
|||||||
PacketLineIn packetIn = new PacketLineIn(in);
|
PacketLineIn packetIn = new PacketLineIn(in);
|
||||||
for (; ; ) {
|
for (; ; ) {
|
||||||
String s = packetIn.readString();
|
String s = packetIn.readString();
|
||||||
if (isPacketLineEnd(s)) {
|
if (PacketLineIn.isEnd(s)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!s.startsWith(argCmd)) {
|
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
|
@Override
|
||||||
protected void runImpl() throws IOException, PermissionBackendException, Failure {
|
protected void runImpl() throws IOException, PermissionBackendException, Failure {
|
||||||
PacketLineOut packetOut = new PacketLineOut(out);
|
PacketLineOut packetOut = new PacketLineOut(out);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user