From: Drew DeVault <drew@ddevault.org>
To: git@vger.kernel.org
Cc: Drew DeVault <drew@ddevault.org>,
Martin von Zweigbergk <martinvonz@google.com>,
Patrick Steinhardt <ps@pks.im>, Andy Koppe <andy.koppe@gmail.com>,
"Remo Senekowitsch" <remo@buenzli.dev>
Subject: [PATCH v2 1/2] pretty: add X-Change-ID to mail formats
Date: Thu, 3 Jul 2025 13:29:51 +0200 [thread overview]
Message-ID: <20250703113505.11889-1-drew@ddevault.org> (raw)
Introduce the X-Change-ID header to emails prepared by git (i.e. via
format-patch, send-email). This allows tools which work with those
emails (e.g. patchwork, sourcehut) to meaningfully integrate with tools
that assign change IDs to commits.
With some follow-up work, this is also the first step towards ensuring
that those change IDs are preserved through from git-send-email to
git-am as a change moves through its review lifecycle.
Signed-off-by: Drew DeVault <drew@ddevault.org>
---
v2 is unchanged from v1.
One remark that occurs to me upon spinning v2 is that I'm not sure how
to test this behavior. There is no obvious way to cause git upstream to
produce a commit with a change-id -- presently these are only ever added
by third-party tools.
pretty.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pretty.c b/pretty.c
index 0bc8ad8a9a..70fba7b023 100644
--- a/pretty.c
+++ b/pretty.c
@@ -2045,7 +2045,7 @@ static void pp_header(struct pretty_print_context *pp,
int parents_shown = 0;
for (;;) {
- const char *name, *line = *msg_p;
+ const char *name, *change_id, *line = *msg_p;
int linelen = get_one_line(*msg_p);
if (!linelen)
@@ -2089,6 +2089,11 @@ static void pp_header(struct pretty_print_context *pp,
strbuf_grow(sb, linelen + 80);
pp_user_info(pp, "Commit", sb, name, encoding);
}
+ if (skip_prefix(line, "change-id ", &change_id) &&
+ cmit_fmt_is_mail(pp->fmt)) {
+ strbuf_addf(sb, "X-Change-ID: %.*s\n",
+ linelen - 11, change_id);
+ }
}
}
--
2.50.0
next reply other threads:[~2025-07-03 11:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 11:29 Drew DeVault [this message]
2025-07-03 11:29 ` [PATCH v2 2/2] am: import X-Change-ID from email headers Drew DeVault
2025-07-06 3:37 ` [PATCH v2 1/2] pretty: add X-Change-ID to mail formats Jeff King
2025-07-06 10:46 ` Drew DeVault
2025-07-06 6:20 ` Aditya Garg
2025-07-06 10:41 ` Drew DeVault
2025-07-07 1:30 ` Junio C Hamano
2025-07-07 5:53 ` Junio C Hamano
2025-07-07 6:57 ` Martin von Zweigbergk
2025-07-07 6:59 ` Martin von Zweigbergk
2025-07-07 12:40 ` Junio C Hamano
2025-07-07 7:12 ` Drew DeVault
2025-07-07 7:09 ` Drew DeVault
2025-08-19 17:45 ` Remo Senekowitsch
2025-08-20 7:29 ` Drew DeVault
2025-08-21 0:50 ` Junio C Hamano
2025-08-21 8:52 ` Drew DeVault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250703113505.11889-1-drew@ddevault.org \
--to=drew@ddevault.org \
--cc=andy.koppe@gmail.com \
--cc=git@vger.kernel.org \
--cc=martinvonz@google.com \
--cc=ps@pks.im \
--cc=remo@buenzli.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).