File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ protected function doParse()
55
55
$ newMode = $ this ->consumeTo ("\n" );
56
56
$ this ->consumeNewLine ();
57
57
$ oldMode = null ;
58
+ $ oldName = '/dev/null ' ;
58
59
}
59
60
if ($ this ->expects ('old mode ' )) {
60
61
$ oldMode = $ this ->consumeTo ("\n" );
@@ -66,6 +67,7 @@ protected function doParse()
66
67
if ($ this ->expects ('deleted file mode ' )) {
67
68
$ oldMode = $ this ->consumeTo ("\n" );
68
69
$ newMode = null ;
70
+ $ newName = '/dev/null ' ;
69
71
$ this ->consumeNewLine ();
70
72
}
71
73
Original file line number Diff line number Diff line change @@ -259,4 +259,26 @@ public function testThrowErrorOnBlobGetWithoutIndex()
259
259
$ this ->assertSame ('' , $ file ->getOldIndex ());
260
260
$ this ->assertSame ('' , $ file ->getNewIndex ());
261
261
}
262
+
263
+ public function testEmptyNewFile ()
264
+ {
265
+ $ diff = Diff::parse ("diff --git a/test b/test \nnew file mode 100644 \nindex 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 \n" );
266
+ $ firstFile = $ diff ->getFiles ()[0 ];
267
+
268
+ $ this ->assertTrue ($ firstFile ->isCreation ());
269
+ $ this ->assertFalse ($ firstFile ->isDeletion ());
270
+ $ this ->assertSame ('test ' , $ firstFile ->getNewName ());
271
+ $ this ->assertNull ($ firstFile ->getOldName ());
272
+ }
273
+
274
+ public function testEmptyOldFile ()
275
+ {
276
+ $ diff = Diff::parse ("diff --git a/test b/test \ndeleted file mode 100644 \nindex e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 \n" );
277
+ $ firstFile = $ diff ->getFiles ()[0 ];
278
+
279
+ $ this ->assertFalse ($ firstFile ->isCreation ());
280
+ $ this ->assertTrue ($ firstFile ->isDeletion ());
281
+ $ this ->assertNull ($ firstFile ->getNewName ());
282
+ $ this ->assertSame ('test ' , $ firstFile ->getOldName ());
283
+ }
262
284
}
You can’t perform that action at this time.
0 commit comments