diff --git a/aider_gitea/__main__.py b/aider_gitea/__main__.py index ce918fd..c7f9bb6 100644 --- a/aider_gitea/__main__.py +++ b/aider_gitea/__main__.py @@ -25,7 +25,8 @@ def generate_branch_name(issue_number: str, issue_title: str) -> str: the text is lowercased, and spaces are replaced with dashes. """ sanitized = re.sub(r"[^0-9a-zA-Z ]+", "", issue_title) - return "issue-" + "-".join(sanitized.lower().split()) + parts = ['issue', issue_number, *sanitized.lower().split()] + return "-".join(parts) logger = logging.getLogger(__name__) diff --git a/test/test_generate_branch_name.py b/test/test_generate_branch_name.py index 2473f0e..376d462 100644 --- a/test/test_generate_branch_name.py +++ b/test/test_generate_branch_name.py @@ -7,11 +7,8 @@ def test_generate_branch_name_normal(): assert branch == "issue-123-some-issue-title" def test_generate_branch_name_special_characters(): - # Test where title contains special characters. branch = generate_branch_name("45", "Issue @ Special!") - # This test expects only the space replaced and lower-casing. - # Adjust the expected value if more sophisticated slugification is added. - assert branch == "issue-45-issue-@-special!" + assert branch == "issue-45-issue-special" def test_generate_branch_name_numeric_title(): # Test where the title starts with numbers.