@@ -190,19 +190,21 @@ function parsePatchLines(
190190 currentFilePatch . diffLineFromPath = match [ 1 ]
191191 currentFilePatch . diffLineToPath = match [ 2 ]
192192 } else if ( line . startsWith ( "old mode " ) ) {
193- currentFilePatch . oldMode = line . slice ( "old mode " . length )
193+ currentFilePatch . oldMode = line . slice ( "old mode " . length ) . trim ( )
194194 } else if ( line . startsWith ( "new mode " ) ) {
195- currentFilePatch . newMode = line . slice ( "new mode " . length )
195+ currentFilePatch . newMode = line . slice ( "new mode " . length ) . trim ( )
196196 } else if ( line . startsWith ( "deleted file mode " ) ) {
197- currentFilePatch . deletedFileMode = line . slice (
198- "deleted file mode " . length ,
199- )
197+ currentFilePatch . deletedFileMode = line
198+ . slice ( "deleted file mode " . length )
199+ . trim ( )
200200 } else if ( line . startsWith ( "new file mode " ) ) {
201- currentFilePatch . newFileMode = line . slice ( "new file mode " . length )
201+ currentFilePatch . newFileMode = line
202+ . slice ( "new file mode " . length )
203+ . trim ( )
202204 } else if ( line . startsWith ( "rename from " ) ) {
203- currentFilePatch . renameFrom = line . slice ( "rename from " . length )
205+ currentFilePatch . renameFrom = line . slice ( "rename from " . length ) . trim ( )
204206 } else if ( line . startsWith ( "rename to " ) ) {
205- currentFilePatch . renameTo = line . slice ( "rename to " . length )
207+ currentFilePatch . renameTo = line . slice ( "rename to " . length ) . trim ( )
206208 } else if ( line . startsWith ( "index " ) ) {
207209 const match = line . match ( / ( \w + ) \. \. ( \w + ) / )
208210 if ( ! match ) {
@@ -211,9 +213,9 @@ function parsePatchLines(
211213 currentFilePatch . beforeHash = match [ 1 ]
212214 currentFilePatch . afterHash = match [ 2 ]
213215 } else if ( line . startsWith ( "--- " ) ) {
214- currentFilePatch . fromPath = line . slice ( "--- a/" . length )
216+ currentFilePatch . fromPath = line . slice ( "--- a/" . length ) . trim ( )
215217 } else if ( line . startsWith ( "+++ " ) ) {
216- currentFilePatch . toPath = line . slice ( "+++ b/" . length )
218+ currentFilePatch . toPath = line . slice ( "+++ b/" . length ) . trim ( )
217219 }
218220 } else {
219221 if ( supportLegacyDiffs && line . startsWith ( "--- a/" ) ) {
0 commit comments