diff options
author | Twist <itsluketwist@gmail.com> | 2022-08-24 19:05:45 +0100 |
---|---|---|
committer | Twist <itsluketwist@gmail.com> | 2022-08-24 19:05:45 +0100 |
commit | 09f8a1b7b674d6138b872643b13ffc5444fab24f (patch) | |
tree | 09f226e4bd4e304d6a0be8677bb6ed9cf022462b | |
parent | c2fd97e374f9c1187f165b18651928c011e6f041 (diff) | |
download | gitpython-09f8a1b7b674d6138b872643b13ffc5444fab24f.tar.gz |
Use the same regex as the Actor class when determining co-authors.
-rw-r--r-- | git/objects/commit.py | 6 | ||||
-rw-r--r-- | test/test_commit.py | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/git/objects/commit.py b/git/objects/commit.py index 58f0bde7..cf7d9aaa 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -752,11 +752,11 @@ class Commit(base.Object, TraversableIterableObj, Diffable, Serializable): 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 diff --git a/test/test_commit.py b/test/test_commit.py index a08ac39b..c5a43c94 100644 --- a/test/test_commit.py +++ b/test/test_commit.py @@ -517,7 +517,7 @@ JzJMZDRLQLFvnzqZuCjE 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"), |