diff --git a/harbor/logbook_auto.py b/harbor/logbook_auto.py index a78f807..7fefb45 100644 --- a/harbor/logbook_auto.py +++ b/harbor/logbook_auto.py @@ -61,7 +61,8 @@ def _kind(files): def log_commits(project, repo, since, head): """One ship's log entry per commit on main after `since` (oldest first); a summary when there are many.""" raw = _git(repo, "log", "--reverse", "--no-merges", "--format=%H%x1f%cI%x1f%s%x1f%b%x1e", f"{since}..{head}") - commits = [c.strip().split("\x1f") for c in raw.split("\x1e") if c.strip()] + # str.strip() counts \x1f as whitespace and would eat an empty body's field, so trim newlines only and pad + commits = [(c.strip("\r\n").split("\x1f") + [""] * 4)[:4] for c in raw.split("\x1e") if c.strip("\r\n")] added = [] if len(commits) > MAX_ENTRIES: subjects = "\n".join(f"- {c[2]} ({c[0][:8]})" for c in commits[-40:])