Skip to content

Commit de04bd6

Browse files
committed
1 parent e38cd3a commit de04bd6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffWriter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void write(UnifiedDiff diff, Function<String, List<String>> origin
5959
writer.accept("index " + file.getIndex());
6060
}
6161

62-
writer.accept("--- " + file.getFromFile());
62+
writer.accept("--- " + (file.getFromFile() == null ? "/dev/null" : file.getFromFile()));
6363

6464
if (file.getToFile() != null) {
6565
writer.accept("+++ " + file.getToFile());
@@ -96,7 +96,7 @@ public static void write(UnifiedDiff diff, Function<String, List<String>> origin
9696

9797
}
9898
// don't forget to process the last set of Deltas
99-
processDeltas(writer, originalLines, deltas, contextSize,
99+
processDeltas(writer, originalLines, deltas, contextSize,
100100
patchDeltas.size() == 1 && file.getFromFile() == null);
101101
}
102102

@@ -156,7 +156,7 @@ private static void processDeltas(Consumer<String> writer,
156156
AbstractDelta<String> nextDelta = deltas.get(deltaIndex);
157157
int intermediateStart = curDelta.getSource().getPosition()
158158
+ curDelta.getSource().getLines().size();
159-
for (line = intermediateStart; line < nextDelta.getSource().getPosition()
159+
for (line = intermediateStart; line < nextDelta.getSource().getPosition()
160160
&& line < origLines.size(); line++) {
161161
// output the code between the last Delta and this one
162162
buffer.add(" " + origLines.get(line));

0 commit comments

Comments
 (0)