git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] mailinfo: hack to accept in-line annotations in patches.

From
Junio C Hamano <junkio@cox.net>
Date
Dec 12, 2006, 01:15 UTC
Message-ID
<7vu001zzgb.fsf@assigned-by-dhcp.cox.net>

Long before git-apply, when I wanted to talk about rationale of individual changes, I used to add annotation between hunks (delimited @@ -n,m, +l,k @@) as unindented plain text and rely on GNU patch to discard them as garbage. Because git-apply is much less forgiving than GNU patch, this is not possible.

This patch teaches mailinfo that lines that begin with a '|' would never appear in the patch text and can be discarded safely. Which means that we can generate a patch as usual using format-patch, and add annotations inline, prefixed with '|'.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * I am not seriously suggesting this for inclusion but people
   might find this handy -- see the first edition of my
   git-commit documentation patch for an example (although I
   seem to have botched the hand-munge of that message).
 builtin-mailinfo.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index b8d7dbc..7819be1 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -710,8 +710,11 @@ static void handle_patch(void)
 		 * here; we are dealing with the user payload.
 		 */
 		decode_transfer_encoding(line);
-		fputs(line, patchfile);
-		patch_lines++;
+
+		if (line[0] != '|') {
+			fputs(line, patchfile);
+			patch_lines++;
+		}
 	} while (fgets(line, sizeof(line), fin) != NULL);
 }
 
-- 
1.4.4.2.g7d2d-dirty
Message 1 of 1 in “mailinfo: hack to accept in-line annotations in patches.”
  1. mailinfo: hack to accept in-line annotations in patches.Junio C Hamano, Dec 12, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.