From 5215321466c122d0edd404054d427aa6f41da6d7 Mon Sep 17 00:00:00 2001 From: romellem Date: Mon, 9 Oct 2017 09:25:02 -0500 Subject: [PATCH] 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. --- src/diff-parser.js | 2 +- test/diff-parser-tests.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/diff-parser.js b/src/diff-parser.js index 4f3fdf6..57892cb 100644 --- a/src/diff-parser.js +++ b/src/diff-parser.js @@ -435,7 +435,7 @@ // Cleanup timestamps generated by the unified diff (diff command) as specified in // https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html // Ie: 2016-10-25 11:37:14.000000000 +0200 - filename = filename.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? \+\d{4}.*$/, ''); + filename = filename.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [-+]\d{4}.*$/, ''); } return filename; diff --git a/test/diff-parser-tests.js b/test/diff-parser-tests.js index 756c3f8..2574c19 100644 --- a/test/diff-parser-tests.js +++ b/test/diff-parser-tests.js @@ -432,8 +432,6 @@ describe('DiffParser', function() { }); assert.deepEqual(linesContent, ['-test', '+test1r', '+test2r']); }); - - }); it('should parse unified non git diff', function() {