@@ -182,11 +182,11 @@ public static Patch parseUnifiedDiff(List<String> diff) {
182
182
*/
183
183
public static List <String > generateUnifiedDiff (String original , String revised ,
184
184
List <String > originalLines , Patch patch , int contextSize ) {
185
- List <String > ret = new ArrayList <String >();
186
- ret .add ("--- " + original );
187
- ret .add ("+++ " + revised );
188
-
189
185
if (!patch .getDeltas ().isEmpty ()) {
186
+ List <String > ret = new ArrayList <String >();
187
+ ret .add ("--- " + original );
188
+ ret .add ("+++ " + revised );
189
+
190
190
List <Delta > patchDeltas = new ArrayList <Delta >(patch .getDeltas ());
191
191
192
192
// code outside the if block also works for single-delta issues.
@@ -220,8 +220,9 @@ public static List<String> generateUnifiedDiff(String original, String revised,
220
220
// don't forget to process the last set of Deltas
221
221
List <String > curBlock = processDeltas (originalLines , deltas , contextSize );
222
222
ret .addAll (curBlock );
223
+ return ret ;
223
224
}
224
- return ret ;
225
+ return new ArrayList < String >() ;
225
226
}
226
227
227
228
/**
@@ -260,7 +261,7 @@ private static List<String> processDeltas(List<String> origLines, List<Delta> de
260
261
}
261
262
262
263
// output the context before the first Delta
263
- for (line = contextStart ; line < curDelta .getOriginal ().getPosition (); line ++) { //
264
+ for (line = contextStart ; line < curDelta .getOriginal ().getPosition (); line ++) { //
264
265
buffer .add (" " + origLines .get (line ));
265
266
origTotal ++;
266
267
revTotal ++;
0 commit comments