Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09f8a1b

Browse files
committed
Use the same regex as the Actor class when determining co-authors.
1 parent c2fd97e commit 09f8a1b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

git/objects/commit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,11 +752,11 @@ def co_authors(self) -> List[Actor]:
752752

753753
if self.message:
754754
results = re.findall(
755-
r"^Co-authored-by: ((?:\w|\-| ){0,38} <\S*>)$",
755+
r"^Co-authored-by: (.*) <(.*?)>$",
756756
self.message,
757757
re.MULTILINE,
758758
)
759-
for author_string in results:
760-
co_authors.append(Actor._from_string(author_string))
759+
for author in results:
760+
co_authors.append(Actor(*author))
761761

762762
return co_authors

test/test_commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ def test_commit_co_authors(self):
517517
Co-authored-by: Test User 1 <[email protected]>
518518
Co-authored-by: test_user_2 <[email protected]>
519519
Co_authored_by: test_user_x <[email protected]>
520-
Co-authored-by: test_user_y <poorly formatted email @github.com>
520+
Co-authored-by: test_user_y <test@github.com> text
521521
Co-authored-by: test_user_3 <[email protected]>"""
522522
assert commit.co_authors == [
523523
Actor("Test User 1", "[email protected]"),

0 commit comments

Comments
 (0)