about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKatalin Rebhan <me@dblsaiko.net>2025-05-09 18:39:36 +0200
committerRory& <root@rory.gay>2026-02-06 14:14:41 +0100
commitad5445ba9ff8e1ba03bf68cc107e8ff45c1bbafd (patch)
treed18cd4e86f888e0d2767764bd7b69cba4ab5c2d9
parentSendfile, minor fixes in static file support, spawn more processes in test, c... (diff)
downloadcgit-magenta-ad5445ba9ff8e1ba03bf68cc107e8ff45c1bbafd.tar.xz
Show change-id header content if present
-rw-r--r--cgit.h1
-rw-r--r--parsing.c14
-rw-r--r--shared.c3
-rw-r--r--ui-commit.c8
4 files changed, 24 insertions, 2 deletions
diff --git a/cgit.h b/cgit.h

index b6bedd3..9a7d495 100644 --- a/cgit.h +++ b/cgit.h
@@ -142,6 +142,7 @@ struct commitinfo { char *subject; char *msg; char *msg_encoding; + char *change_id; }; struct taginfo { diff --git a/parsing.c b/parsing.c
index 115ce81..2274dd7 100644 --- a/parsing.c +++ b/parsing.c
@@ -169,8 +169,18 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) if (!ret->msg_encoding) ret->msg_encoding = xstrdup("UTF-8"); - while (!end_of_header(p)) - p = next_header_line(p); + while (!end_of_header(p)) { + if (p && skip_prefix(p, "change-id ", &p)) { + t = strchr(p, '\n'); + if (t) { + ret->change_id = substr(p, t + 1); + p = t + 1; + } + } else { + p = next_header_line(p); + } + } + while (p && *p == '\n') p++; if (!p) diff --git a/shared.c b/shared.c
index 07b38ba..86be047 100644 --- a/shared.c +++ b/shared.c
@@ -108,6 +108,9 @@ void cgit_free_commitinfo(struct commitinfo *info) free(info->subject); free(info->msg); free(info->msg_encoding); + if (info->change_id) { + free(info->change_id); + } free(info); } diff --git a/ui-commit.c b/ui-commit.c
index 5536ffc..12de4c7 100644 --- a/ui-commit.c +++ b/ui-commit.c
@@ -73,7 +73,15 @@ void cgit_print_commit(char *hex, const char *prefix) html_txt(show_date(info->committer_date, info->committer_tz, cgit_date_mode(DATE_ISO8601))); html("</td></tr>\n"); + + if (info->change_id) { + html("<tr><th>change</th><td colspan='2' class='sha1'>"); + html_txt(info->change_id); + html("</td></tr>\n"); + } + html("<tr><th>commit</th><td colspan='2' class='oid'>"); + tmp = oid_to_hex(&commit->object.oid); cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix); html(" (");