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 @@ -38,6 +38,7 @@ protected function doParse()
38
38
$ newMode = $ this ->consumeTo ("\n" );
39
39
$ this ->consumeNewLine ();
40
40
$ oldMode = null ;
41
+ $ oldName = '/dev/null ' ;
41
42
}
42
43
if ($ this ->expects ('old mode ' )) {
43
44
$ oldMode = $ this ->consumeTo ("\n" );
@@ -49,6 +50,7 @@ protected function doParse()
49
50
if ($ this ->expects ('deleted file mode ' )) {
50
51
$ oldMode = $ this ->consumeTo ("\n" );
51
52
$ newMode = null ;
53
+ $ newName = '/dev/null ' ;
52
54
$ this ->consumeNewLine ();
53
55
}
54
56
Original file line number Diff line number Diff line change @@ -150,4 +150,26 @@ public function testWorksWithUmlauts($repository)
150
150
$ files = $ repository ->getCommit (self ::FILE_WITH_UMLAUTS_COMMIT )->getDiff ()->getFiles ();
151
151
$ this ->assertSame ('file_with_umlauts_\303\244\303\266\303\274 ' , $ files [0 ]->getNewName ());
152
152
}
153
+
154
+ public function testEmptyNewFile ()
155
+ {
156
+ $ diff = Diff::parse ("diff --git a/test b/test \nnew file mode 100644 \nindex 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 \n" );
157
+ $ firstFile = $ diff ->getFiles ()[0 ];
158
+
159
+ $ this ->assertTrue ($ firstFile ->isCreation ());
160
+ $ this ->assertFalse ($ firstFile ->isDeletion ());
161
+ $ this ->assertSame ('test ' , $ firstFile ->getNewName ());
162
+ $ this ->assertNull ($ firstFile ->getOldName ());
163
+ }
164
+
165
+ public function testEmptyOldFile ()
166
+ {
167
+ $ diff = Diff::parse ("diff --git a/test b/test \ndeleted file mode 100644 \nindex e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 \n" );
168
+ $ firstFile = $ diff ->getFiles ()[0 ];
169
+
170
+ $ this ->assertFalse ($ firstFile ->isCreation ());
171
+ $ this ->assertTrue ($ firstFile ->isDeletion ());
172
+ $ this ->assertNull ($ firstFile ->getNewName ());
173
+ $ this ->assertSame ('test ' , $ firstFile ->getOldName ());
174
+ }
153
175
}
You can’t perform that action at this time.
0 commit comments