Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitc282315

Browse files
author
Sebastian Thiel
committed
Fix regex to support empty email addresses i.e. 'name <>'
Fixes#833
1 parent77e47bc commitc282315

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

‎git/test/test_util.py

Lines 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+
deftest_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
deftest_iterable_list(self,case):
217222
name,prefix=case

‎git/util.py

Lines 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)

[8]ページ先頭

©2009-2025 Movatter.jp