@@ -59,7 +59,7 @@ public static void write(UnifiedDiff diff, Function<String, List<String>> origin
59
59
writer .accept ("index " + file .getIndex ());
60
60
}
61
61
62
- writer .accept ("--- " + file .getFromFile ());
62
+ writer .accept ("--- " + ( file .getFromFile () == null ? "/dev/null" : file . getFromFile () ));
63
63
64
64
if (file .getToFile () != null ) {
65
65
writer .accept ("+++ " + file .getToFile ());
@@ -96,7 +96,7 @@ public static void write(UnifiedDiff diff, Function<String, List<String>> origin
96
96
97
97
}
98
98
// don't forget to process the last set of Deltas
99
- processDeltas (writer , originalLines , deltas , contextSize ,
99
+ processDeltas (writer , originalLines , deltas , contextSize ,
100
100
patchDeltas .size () == 1 && file .getFromFile () == null );
101
101
}
102
102
@@ -156,7 +156,7 @@ private static void processDeltas(Consumer<String> writer,
156
156
AbstractDelta <String > nextDelta = deltas .get (deltaIndex );
157
157
int intermediateStart = curDelta .getSource ().getPosition ()
158
158
+ curDelta .getSource ().getLines ().size ();
159
- for (line = intermediateStart ; line < nextDelta .getSource ().getPosition ()
159
+ for (line = intermediateStart ; line < nextDelta .getSource ().getPosition ()
160
160
&& line < origLines .size (); line ++) {
161
161
// output the code between the last Delta and this one
162
162
buffer .add (" " + origLines .get (line ));
0 commit comments