git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Sasburg <simon.sasburg@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Simon Sasburg <Simon.Sasburg@gmail.com>
Subject: [PATCH] Make git-mailinfo strip whitespace from the start of the mail file.
Date: Thu,  1 Nov 2007 22:05:39 +0100	[thread overview]
Message-ID: <1193951139-2312-1-git-send-email-Simon.Sasburg@gmail.com> (raw)

This allows you to use files gotten through gmail's web interface via its 'Show original' option.

Signed-off-by: Simon Sasburg <Simon.Sasburg@gmail.com>
---
Note that this doesn't exactly follow RFC 2822 as far as i can see, but i don't know if git prefers to be strict or tolerant in these cases, so i'm sending the patch anyway.

It certaily helps me, even if just a little bit.

 builtin-mailinfo.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index fb12248..5d4b6bf 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -915,6 +915,7 @@ static void handle_info(void)
 static int mailinfo(FILE *in, FILE *out, int ks, const char *encoding,
 		    const char *msg, const char *patch)
 {
+	int peek;
 	keep_subject = ks;
 	metainfo_charset = encoding;
 	fin = in;
@@ -935,6 +936,11 @@ static int mailinfo(FILE *in, FILE *out, int ks, const char *encoding,
 	p_hdr_data = xcalloc(MAX_HDR_PARSED, sizeof(char *));
 	s_hdr_data = xcalloc(MAX_HDR_PARSED, sizeof(char *));
 
+	do {
+		peek = fgetc(in);
+	} while (peek == ' ' || peek == '\r' || peek == '\n');
+	ungetc(peek, in);
+
 	/* process the email header */
 	while (read_one_header_line(line, sizeof(line), fin))
 		check_header(line, sizeof(line), p_hdr_data, 1);
-- 
1.5.3.4.502.g37c97

             reply	other threads:[~2007-11-01 21:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01 21:05 Simon Sasburg [this message]
2007-11-01 21:33 ` [PATCH] Make git-mailinfo strip whitespace from the start of the mail file Junio C Hamano
2007-11-01 21:41   ` Simon Sasburg
2007-11-01 22:26     ` Junio C Hamano
2007-11-01 22:57       ` [PATCH] Make git-mailsplit strip whitespace from the start of the mailbox file Simon Sasburg
2007-11-02  8:53 ` [PATCH] Make git-mailinfo strip whitespace from the start of the mail file Junio C Hamano
2007-11-04 13:32   ` [PATCH] Make git-mailsplit strip whitespace from the start of the mailbox file Simon Sasburg

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=1193951139-2312-1-git-send-email-Simon.Sasburg@gmail.com \
    --to=simon.sasburg@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).