Fix a tiny bug in FileDiffCache for commit messages

This hasn't surfaced in tests because the Get Diff REST endpoint isn't
yet modified to use the new FileDiffCache. Detected this case while
debugging.

Change-Id: I463a20aab7ea376a29be32ee4e3ba83b831a17cb
This commit is contained in:
Youssef Elghareeb
2021-02-09 14:35:17 +01:00
parent 8b0ffecf23
commit 7391dfbd83

View File

@@ -246,7 +246,7 @@ public class FileDiffCacheImpl implements FileDiffCache {
RawTextComparator rawTextComparator,
GitFileDiffCacheImpl.DiffAlgorithm diffAlgorithm)
throws IOException {
Text aText = newCommit != null ? Text.forCommit(reader, newCommit) : Text.EMPTY;
Text aText = oldCommit != null ? Text.forCommit(reader, oldCommit) : Text.EMPTY;
Text bText = Text.forCommit(reader, newCommit);
return createMagicFileDiffOutput(
rawTextComparator, oldCommit, aText, bText, Patch.COMMIT_MSG, diffAlgorithm);