Merge "PureRevert: Don't write any output when computing diff"
This commit is contained in:
@@ -36,7 +36,6 @@ import com.google.inject.Module;
|
|||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import com.google.inject.name.Named;
|
import com.google.inject.name.Named;
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
@@ -50,6 +49,7 @@ import org.eclipse.jgit.lib.Repository;
|
|||||||
import org.eclipse.jgit.merge.ThreeWayMerger;
|
import org.eclipse.jgit.merge.ThreeWayMerger;
|
||||||
import org.eclipse.jgit.revwalk.RevCommit;
|
import org.eclipse.jgit.revwalk.RevCommit;
|
||||||
import org.eclipse.jgit.revwalk.RevWalk;
|
import org.eclipse.jgit.revwalk.RevWalk;
|
||||||
|
import org.eclipse.jgit.util.io.DisabledOutputStream;
|
||||||
|
|
||||||
/** Computes and caches if a change is a pure revert of another change. */
|
/** Computes and caches if a change is a pure revert of another change. */
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -188,9 +188,8 @@ public class PureRevertCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Any differences between claimed original's parent and the rebase result indicate that
|
// Any differences between claimed original's parent and the rebase result indicate that
|
||||||
// the
|
// the claimedRevert is not a pure revert but made content changes
|
||||||
// claimedRevert is not a pure revert but made content changes
|
try (DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE)) {
|
||||||
try (DiffFormatter df = new DiffFormatter(new ByteArrayOutputStream())) {
|
|
||||||
df.setReader(oi.newReader(), repo.getConfig());
|
df.setReader(oi.newReader(), repo.getConfig());
|
||||||
List<DiffEntry> entries =
|
List<DiffEntry> entries =
|
||||||
df.scan(claimedOriginalCommit.getParent(0), merger.getResultTreeId());
|
df.scan(claimedOriginalCommit.getParent(0), merger.getResultTreeId());
|
||||||
|
|||||||
Reference in New Issue
Block a user