🚧 Update commit message format

This commit is contained in:
Jonas Bengtsson
2026-09-12 11:49:03 +02:00
parent 17596907f5
commit e773703ed3
8 changed files with 153 additions and 82 deletions
+19 -6
View File
@@ -100,23 +100,36 @@ class TestRunCycle:
)
_run(tracker_config, tmp_path)
body = _git_out("log", "-1", "--format=%b", cwd=git_repo)
assert "Last modified by: DOMAIN\\jsmith" in body
# One-line entry: letter ; path ; author ; local-time mtime
assert " A ; config.xml ; DOMAIN\\jsmith ; " in body
def test_file_mtime_appears_in_commit_local_time(
self, git_repo: Path, tracker_config: dict, tmp_path: Path
) -> None:
"""Section 12 file_timestamp rendered as 'Modified at' (local time)."""
"""Section 12 file_timestamp on the one-line entry (local time)."""
import re as re_mod
(git_repo / "config.xml").write_text("<c/>", encoding="utf-8")
_run(tracker_config, tmp_path)
body = _git_out("log", "-1", "--format=%b", cwd=git_repo)
# Local-time format with explicit +/-HH:MM offset (Section 15)
# A ; path ; author ; local-time mtime with +/-HH:MM offset
assert re_mod.search(
r"Modified at: \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}\b", body
r"^ A ; config\.xml ; UNKNOWN ; "
r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}$",
body,
flags=re_mod.MULTILINE,
)
# The timestamp block sits directly under the changed file entry
assert " config.xml\n Last modified by: UNKNOWN\n Modified at:" in body
def test_custom_separator_in_real_commit(
self, git_repo: Path, tracker_config: dict, tmp_path: Path
) -> None:
"""commit.file_separator flows from configuration into the commit."""
tracker_config["commit"] = {"file_separator": "|"}
(git_repo / "config.xml").write_text("<c/>", encoding="utf-8")
_run(tracker_config, tmp_path)
body = _git_out("log", "-1", "--format=%b", cwd=git_repo)
assert " A | config.xml | UNKNOWN | " in body
assert "; config.xml" not in body
def test_excluded_files_not_committed(
self, git_repo: Path, tracker_config: dict, tmp_path: Path