From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH] mailinfo: hack to accept in-line annotations in patches.
Date: Mon, 11 Dec 2006 17:15:48 -0800 [thread overview]
Message-ID: <7vu001zzgb.fsf@assigned-by-dhcp.cox.net> (raw)
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
reply other threads:[~2006-12-12 1:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=7vu001zzgb.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
/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