@@ -90,6 +90,38 @@ def test_parse_commit_message_body_breaking() -> None:
9090 assert entry .is_breaking is True
9191
9292
93+ def test_parse_commit_message_multiline_breaking_footer () -> None :
94+ multiline_body = (
95+ "Migrate internal auth from HMAC tokens to OAuth2 bearer tokens.\n \n "
96+ "This improves security and aligns with current RFC specifications.\n \n "
97+ "Reviewed-on: https://github.com/example/repo/pull/42\n "
98+ "BREAKING CHANGE: HMAC tokens are no longer accepted on API v2 endpoints."
99+ )
100+ entry = parse_commit_message (
101+ commit_hash = "def789" ,
102+ subject = "feat(auth): transition to oauth2 tokens" ,
103+ body = multiline_body ,
104+ )
105+ assert entry .commit_type == "feat"
106+ assert entry .scope == "auth"
107+ assert entry .description == "transition to oauth2 tokens"
108+ assert entry .is_breaking is True
109+
110+
111+ def test_parse_commit_message_multiline_breaking_hyphen_footer () -> None :
112+ multiline_body = (
113+ "Remove deprecated configuration parameters.\n \n "
114+ "BREAKING-CHANGE: The 'legacy_mode' setting has been completely removed."
115+ )
116+ entry = parse_commit_message (
117+ commit_hash = "abc999" ,
118+ subject = "refactor(config): prune legacy config options" ,
119+ body = multiline_body ,
120+ )
121+ assert entry .commit_type == "refactor"
122+ assert entry .is_breaking is True
123+
124+
93125def test_parse_commit_message_non_conventional () -> None :
94126 entry = parse_commit_message (
95127 commit_hash = "ghi789" ,
@@ -165,6 +197,35 @@ def test_extract_commits_between_real_git(git_repo: Path) -> None:
165197 assert "feat(core): add module a" in subjects
166198
167199
200+ def test_extract_commits_between_multiline_breaking_footer (git_repo : Path ) -> None :
201+ subprocess .run (["git" , "tag" , "v2.0.0" ], cwd = git_repo , check = True )
202+ file_path = git_repo / "breaking.py"
203+ file_path .write_text ("API_V2 = True\n " )
204+ subprocess .run (["git" , "add" , "breaking.py" ], cwd = git_repo , check = True )
205+ subprocess .run (
206+ [
207+ "git" ,
208+ "commit" ,
209+ "-m" ,
210+ "feat(api): overhaul authorization" ,
211+ "-m" ,
212+ "Replaces API keys with scoped OAuth tokens." ,
213+ "-m" ,
214+ "BREAKING CHANGE: Plain API keys are no longer supported." ,
215+ ],
216+ cwd = git_repo ,
217+ check = True ,
218+ )
219+ subprocess .run (["git" , "tag" , "v2.1.0" ], cwd = git_repo , check = True )
220+
221+ commits = extract_commits_between ("v2.0.0" , "v2.1.0" , repo = git_repo )
222+ assert len (commits ) == 1
223+ assert commits [0 ].commit_type == "feat"
224+ assert commits [0 ].scope == "api"
225+ assert commits [0 ].is_breaking is True
226+ assert "Plain API keys are no longer supported" in commits [0 ].body
227+
228+
168229def test_generate_changelog_empty_range (git_repo : Path ) -> None :
169230 res = generate_changelog (from_ref = "HEAD" , to_ref = "HEAD" , repo_dir = git_repo )
170231 assert res .is_fallback is False
0 commit comments