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

Lines changed: 2 additions & 2 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy