Sitelet https://github.com/gitpython-developers/GitPython/pull/2221
Skip to content

fix: restore Actor.name_email_regex - #2221

Merged
Byron merged 1 commit into
mainfrom
re-add-regex
Aug 28, 2026
Merged

fix: restore Actor.name_email_regex#2221
Byron merged 1 commit into
mainfrom
re-add-regex

Conversation

@Byron

@Byron Byron commented Aug 28, 2026

Copy link
Copy Markdown
Member

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

Everything below this line was generated by Codex GPT-5.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Fixes #2220

Summary

  • Restore the historical Actor.name_email_regex class member used by downstream projects such as python-semantic-release.
  • Deprecate access while preserving the original compiled-pattern API.
  • Warn that searching long malformed strings with the regex can take quadratic time and recommend Actor._from_string() or direct string parsing.
  • Keep Actor._from_string independent of the regex so malformed identities retain the linear-time parsing introduced for GHSA-g5vv-9gxw-82hx.

Validation

  • test/test_actor.py: 8 passed on Python 3.12.13.
  • Actor-related test/test_util.py coverage passed before the deprecation-only follow-up.
  • ruff check git/util.py test/test_actor.py
  • ruff format --check git/util.py test/test_actor.py
  • basedpyright git/util.py: no errors.
  • Codex review of commit 40825453: no findings.

Copilot AI lite review requested due to automatic review settings August 28, 2026 06:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 28, 2026 06:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 28, 2026 08:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

<!-- agent -->
GitPython 3.1.60 removed the Actor.name_email_regex class attribute while
replacing internal actor parsing, which broke downstream consumers such as
python-semantic-release.

Bring back the historical compiled pattern for downstream compatibility,
but emit DeprecationWarning whenever the class member is accessed. The warning
explains its quadratic behavior on long malformed strings and points callers to
the public Actor(name, email) constructor when fields are separate, or direct
string parsing when they are not.

Assisted-by: GPT 5.6
Co-authored-by: GPT 5.6 <codex@openai.com>

# 252a84ac Add public Actor.from_string constructor (#2220)

Add public Actor.from_string constructor (#2220)

Promote the existing actor identity parser to Actor.from_string while retaining _from_string as a compatibility alias. Point the name_email_regex deprecation warning to the new public constructor or Actor(name, email).

Validation:
- actor-related test/test_actor.py and test/test_util.py cases: 12 passed
- ruff check and format checks passed
- basedpyright git/util.py: no errors

Co-authored-by: Codex GPT-5 <codex@openai.com>

# dd2181d8 Address review feedback about Actor subclasses

Address review feedback about Actor subclasses

Review feedback: Actor.from_string() should preserve the class on which the public classmethod is called instead of always returning a base Actor.

Construct through cls on both parsing paths and cover subclass construction directly.

Validation:
- actor-related test/test_actor.py and test/test_util.py cases: 13 passed
- ruff check and format checks passed
- basedpyright git/util.py: no errors

# fcf1ecb1 Address review feedback about constructor typing

Address review feedback about constructor typing

Review feedback: Actor.from_string() constructs subclasses at runtime but its Actor return annotation prevents type checkers from preserving subclass-specific members.

Use the project existing Python 3.7-compatible bound TypeVar pattern so the declared return type follows cls.

Validation:
- actor-related test/test_actor.py and test/test_util.py cases: 13 passed
- ruff check and format checks passed
- basedpyright git/util.py: no errors

Co-authored-by: Codex GPT-5 <codex@openai.com>
Copilot AI review requested due to automatic review settings August 28, 2026 09:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Byron
Byron merged commit d81336b into main Aug 28, 2026
53 checks passed
@Byron
Byron deleted the re-add-regex branch August 28, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Undeclared breaking change affects python semantic release

2 participants