Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c282315

Browse filesBrowse files
author
Sebastian Thiel
committed
Fix regex to support empty email addresses i.e. 'name <>'
Fixes #833
1 parent 77e47bc commit c282315
Copy full SHA for c282315

File tree

2 files changed

+7
-2
lines changed
Filter options

2 files changed

+7
-2
lines changed

‎git/test/test_util.py

Copy file name to clipboardExpand all lines: git/test/test_util.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ def test_actor(self):
212212
self.assertIsInstance(Actor.author(cr), Actor)
213213
# END assure config reader is handled
214214

215+
def test_actor_from_string(self):
216+
self.assertEqual(Actor._from_string("name"), Actor("name", None))
217+
self.assertEqual(Actor._from_string("name <>"), Actor("name", ""))
218+
self.assertEqual(Actor._from_string("name last another <some-very-long-email@example.com>"), Actor("name last another", "some-very-long-email@example.com"))
219+
215220
@ddt.data(('name', ''), ('name', 'prefix_'))
216221
def test_iterable_list(self, case):
217222
name, prefix = case

‎git/util.py

Copy file name to clipboardExpand all lines: git/util.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,8 @@ class Actor(object):
534534
can be committers and authors or anything with a name and an email as
535535
mentioned in the git log entries."""
536536
# PRECOMPILED REGEX
537-
name_only_regex = re.compile(r'<(.+)>')
538-
name_email_regex = re.compile(r'(.*) <(.+?)>')
537+
name_only_regex = re.compile(r'<(.*)>')
538+
name_email_regex = re.compile(r'(.*) <(.*?)>')
539539

540540
# ENVIRONMENT VARIABLES
541541
# read when creating new commits

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.