[diffoscope] 05/05: diff: updated regex to match lines with only a '\n' char

Juliana Oliveira jwnx-guest at moszumanska.debian.org
Sun Feb 11 01:32:49 CET 2018


This is an automated email from the git hooks/post-receive script.

jwnx-guest pushed a commit to branch jwnx_subprocess_merge
in repository diffoscope.

commit c2a2683c7548263c8a665e023afc006bab8712f5
Author: Juliana Oliveira <juliana.orod at gmail.com>
Date:   Mon Jan 29 00:08:40 2018 -0200

    diff: updated regex to match lines with only a '\n' char
    
    Diff lines containing only a '\n' were not being caught by DiffParser's
    RANGE_RE regex.
    
    Signed-off-by: Juliana Oliveira <juliana.orod at gmail.com>
---
 diffoscope/diff.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/diffoscope/diff.py b/diffoscope/diff.py
index 5664caa..a0dbc93 100644
--- a/diffoscope/diff.py
+++ b/diffoscope/diff.py
@@ -42,7 +42,7 @@ re_diff_change = re.compile(r'^([+-@]).*', re.MULTILINE)
 
 class DiffParser(object):
     RANGE_RE = re.compile(
-        r'^@@\s+-(?P<start1>\d+)(,(?P<len1>\d+))?\s+\+(?P<start2>\d+)(,(?P<len2>\d+))?\s+@@$',
+        r'(^ *\n$)|(^@@\s+-(?P<start1>\d+)(,(?P<len1>\d+))?\s+\+(?P<start2>\d+)(,(?P<len2>\d+))?\s+@@$)',
     )
 
     def __init__(self, output, end_nl_q1, end_nl_q2):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list