Reuse the ObjectInserter in PureRevert to get a new reader

When calling #setRepo on DiffFormatter, JGit creates a new repository
reader. Under certain conditions, this reader may not contain the
modifications made by the merger, resulting in an unknown object being
accessed. This occurs because the merge result is not flushed to the
repository - and this is the correct behavior in this specific case.

Change-Id: Iaba970c1a6eec913de491a20ca781cadcdc3c56b
diff --git a/java/com/google/gerrit/server/change/PureRevert.java b/java/com/google/gerrit/server/change/PureRevert.java
index ee0e2cc..2c450a7 100644
--- a/java/com/google/gerrit/server/change/PureRevert.java
+++ b/java/com/google/gerrit/server/change/PureRevert.java
@@ -117,7 +117,7 @@
       // Any differences between claimed original's parent and the rebase result indicate that the
       // claimedRevert is not a pure revert but made content changes
       try (DiffFormatter df = new DiffFormatter(new ByteArrayOutputStream())) {
-        df.setRepository(repo);
+        df.setReader(oi.newReader(), repo.getConfig());
         List<DiffEntry> entries =
             df.scan(claimedOriginalCommit.getParent(0), merger.getResultTreeId());
         return new PureRevertInfo(entries.isEmpty());