Skip to content

Commit 5215321

Browse files
committed
Fixes regex for timestamps to when behind GMT
Currently, a timezone that ends in say '+0200' will get stripped, but a timezone _behind_ GMT will not (so a timezone in the United States of say, '-0400' will **not** get stripped. This regex change fixes that.
1 parent ea43094 commit 5215321

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

src/diff-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@
435435
// Cleanup timestamps generated by the unified diff (diff command) as specified in
436436
// https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html
437437
// Ie: 2016-10-25 11:37:14.000000000 +0200
438-
filename = filename.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? \+\d{4}.*$/, '');
438+
filename = filename.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [-+]\d{4}.*$/, '');
439439
}
440440

441441
return filename;

test/diff-parser-tests.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,6 @@ describe('DiffParser', function() {
432432
});
433433
assert.deepEqual(linesContent, ['-test', '+test1r', '+test2r']);
434434
});
435-
436-
437435
});
438436

439437
it('should parse unified non git diff', function() {

0 commit comments

Comments
 (0)