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

[PATCH] Make git-mailsplit strip whitespace from the start of the mailbox file.

From
SSSimon Sasburg <simon.sasburg@gmail.com>
Date
Nov 1, 2007, 22:57 UTC
Message-ID
<1193957865-3904-1-git-send-email-Simon.Sasburg@gmail.com>
In-Reply-To
<7vr6j98uw5.fsf@gitster.siamese.dyndns.org>
Signed-off-by: Simon Sasburg <Simon.Sasburg@gmail.com>
---
Ah, i see.
Well, this patch also fixes the problem in my case.
 builtin-mailsplit.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index 43fc373..3fdeb23 100644
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
@@ -164,6 +164,7 @@ static int split_mbox(const char *file, const char *dir, int allow_bare,
 {
 	char name[PATH_MAX];
 	int ret = -1;
+	int peek;
 
 	FILE *f = !strcmp(file, "-") ? stdin : fopen(file, "r");
 	int file_done = 0;
@@ -173,6 +174,11 @@ static int split_mbox(const char *file, const char *dir, int allow_bare,
 		goto out;
 	}
 
+	do {
+		peek = fgetc(f);
+	} while (peek == ' ' || peek == '\r' || peek == '\n');
+	ungetc(peek, f);
+
 	if (fgets(buf, sizeof(buf), f) == NULL) {
 		/* empty stdin is OK */
 		if (f != stdin) {
-- 
1.5.3.4.504.gdf75-dirty
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 7 in “Make git-mailinfo strip whitespace from the start of the mail file.”
  1. Make git-mailinfo strip whitespace from the start of the mail file.Simon Sasburg, Nov 1, 2007
  2. Junio C HamanoNov 1, 2007
  3. Simon SasburgNov 1, 2007
  4. Junio C HamanoNov 1, 2007
  5. Make git-mailsplit strip whitespace from the start of the mailbox file.Simon Sasburg, Nov 1, 2007
  6. Junio C HamanoNov 2, 2007
  7. Make git-mailsplit strip whitespace from the start of the mailbox file.Simon Sasburg, Nov 4, 2007

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.