Skip to content

Add commit co-authors support #1482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use the same regex as the Actor class when determining co-authors.
  • Loading branch information
itsluketwist committed Aug 24, 2022
commit 09f8a1b7b674d6138b872643b13ffc5444fab24f
6 changes: 3 additions & 3 deletions git/objects/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,11 @@ def co_authors(self) -> List[Actor]:

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

return co_authors
2 changes: 1 addition & 1 deletion test/test_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def test_commit_co_authors(self):
Co-authored-by: Test User 1 <602352+test@users.noreply.github.com>
Co-authored-by: test_user_2 <another_user-email@github.com>
Co_authored_by: test_user_x <test@github.com>
Co-authored-by: test_user_y <poorly formatted email @github.com>
Co-authored-by: test_user_y <test@github.com> text
Co-authored-by: test_user_3 <test_user_3@github.com>"""
assert commit.co_authors == [
Actor("Test User 1", "602352+test@users.noreply.github.com"),
Expand Down