Skip to content

Commit 94029ce

Browse files
committed
Adjusted regex to support whitespace - it was a little restrictive previously, although there was absolutely no need for that.
See http://byronimo.lighthouseapp.com/projects/51787/tickets/41-diff-regex-lib_git_diffpy-cannot-handle-paths-with-spaces
1 parent 1364759 commit 94029ce

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/git/diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class Diff(object):
175175
# precompiled regex
176176
re_header = re.compile(r"""
177177
#^diff[ ]--git
178-
[ ]a/(?P<a_path>\S+)[ ]b/(?P<b_path>\S+)\n
178+
[ ]a/(?P<a_path>.+?)[ ]b/(?P<b_path>.+?)\n
179179
(?:^similarity[ ]index[ ](?P<similarity_index>\d+)%\n
180180
^rename[ ]from[ ](?P<rename_from>\S+)\n
181181
^rename[ ]to[ ](?P<rename_to>\S+)(?:\n|$))?

test/fixtures/diff_2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
diff --git a/lib/grit/commit.rb b/lib/grit/commit.rb
22
index a093bb1db8e884cccf396b297259181d1caebed4..80fd3d527f269ecbd570b65b8e21fd85baedb6e9 100644
3-
--- a/lib/grit/commit.rb
4-
+++ b/lib/grit/commit.rb
3+
--- a/lib/grit/com mit.rb
4+
+++ b/lib/grit/com mit.rb
55
@@ -156,12 +156,8 @@ module Grit
66

77
def diffs

0 commit comments

Comments
 (0)