Skip to content

Commit cdf7c5a

Browse files
committed
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).
1 parent 55d40df commit cdf7c5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎git/diff.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ class Diff(object):
208208
(?:^deleted[ ]file[ ]mode[ ](?P<deleted_file_mode>.+)(?:\n|$))?
209209
(?:^index[ ](?P<a_blob_id>[0-9A-Fa-f]+)
210210
\.\.(?P<b_blob_id>[0-9A-Fa-f]+)[ ]?(?P<b_mode>.+)?(?:\n|$))?
211-
(?:^---[ ](?:a/)?(?P<a_path>.*)(?:\n|$))?
212-
(?:^\+\+\+[ ](?:b/)?(?P<b_path>.*)(?:\n|$))?
211+
(?:^---[ ](?:a/)?(?P<a_path>[^\t\n\r\f\v]*)[\t\r\f\v]*(?:\n|$))?
212+
(?:^\+\+\+[ ](?:b/)?(?P<b_path>[^\t\n\r\f\v]*)[\t\r\f\v]*(?:\n|$))?
213213
""".encode('ascii'), re.VERBOSE | re.MULTILINE)
214214
# can be used for comparisons
215215
NULL_HEX_SHA = "0" * 40

0 commit comments

Comments
 (0)