summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Driessen <me@nvie.com>2016-04-15 01:39:58 +0200
committerVincent Driessen <me@nvie.com>2016-04-19 21:46:16 +0200
commitcdf7c5aca2201cf9dfc3cd301264da4ea352b737 (patch)
treebc596211dd9df52b2a3f2de50812a9f2a206802a
parent55d40df99085036ed265fbc6d24d90fbb1a24f95 (diff)
downloadgitpython-cdf7c5aca2201cf9dfc3cd301264da4ea352b737.tar.gz
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).
-rw-r--r--git/diff.py4
1 files changed, 2 insertions, 2 deletions
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<deleted_file_mode>.+)(?:\n|$))?
(?:^index[ ](?P<a_blob_id>[0-9A-Fa-f]+)
\.\.(?P<b_blob_id>[0-9A-Fa-f]+)[ ]?(?P<b_mode>.+)?(?:\n|$))?
- (?:^---[ ](?:a/)?(?P<a_path>.*)(?:\n|$))?
- (?:^\+\+\+[ ](?:b/)?(?P<b_path>.*)(?:\n|$))?
+ (?:^---[ ](?:a/)?(?P<a_path>[^\t\n\r\f\v]*)[\t\r\f\v]*(?:\n|$))?
+ (?:^\+\+\+[ ](?:b/)?(?P<b_path>[^\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