🚧 Add file time information in commit message

This commit is contained in:
Jonas Bengtsson
2026-09-12 11:13:07 +02:00
parent 785867c569
commit 17596907f5
3 changed files with 42 additions and 8 deletions
+9
View File
@@ -3,6 +3,7 @@
from __future__ import annotations
import datetime as dt
import re
from pathlib import Path
import pytest
@@ -152,6 +153,7 @@ class TestCommitMessage:
ChangeRecord(
path="Stations/PS101/project.xml",
change_type=ChangeType.MODIFIED,
file_timestamp=dt.datetime(2026, 9, 11, 6, 42, 9, tzinfo=dt.UTC),
author=AuthorIdentity(
identifier="DOMAIN\\jsmith",
source="scada_audit_log",
@@ -175,6 +177,13 @@ class TestCommitMessage:
assert "Added: 1" in message
assert "Last modified by: DOMAIN\\jsmith" in message
assert "Last modified by: UNKNOWN" in message
# Filesystem mtime rendered as 'Modified at' in local time with offset
assert " Modified at: " in message
assert re.search(
r"Modified at: \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}\b", message
)
# Resolver-provided timestamp kept as a separate 'Changed at' line
assert " Changed at: " in message
assert "Stations/PS027/old.xml" in message
# Trailers last (Section 36)
assert "Tracker-Version: 1.0.0" in message