From cdf7c5aca2201cf9dfc3cd301264da4ea352b737 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Fri, 15 Apr 2016 01:39:58 +0200 Subject: Fix regex This makes sure we're not matching a \n here by accident. It's now almost the same as the original that used \S+, except that spaces are not eaten at the end of the string (for files that end in a space). --- git/diff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git/diff.py') diff --git a/git/diff.py b/git/diff.py index c4fd4b27..fd13f988 100644 --- a/git/diff.py +++ b/git/diff.py @@ -208,8 +208,8 @@ class Diff(object): (?:^deleted[ ]file[ ]mode[ ](?P.+)(?:\n|$))? (?:^index[ ](?P[0-9A-Fa-f]+) \.\.(?P[0-9A-Fa-f]+)[ ]?(?P.+)?(?:\n|$))? - (?:^---[ ](?:a/)?(?P.*)(?:\n|$))? - (?:^\+\+\+[ ](?:b/)?(?P.*)(?:\n|$))? + (?:^---[ ](?:a/)?(?P[^\t\n\r\f\v]*)[\t\r\f\v]*(?:\n|$))? + (?:^\+\+\+[ ](?:b/)?(?P[^\t\n\r\f\v]*)[\t\r\f\v]*(?:\n|$))? """.encode('ascii'), re.VERBOSE | re.MULTILINE) # can be used for comparisons NULL_HEX_SHA = "0" * 40 -- cgit v1.2.1