From: Sverre Rabbelier <srabbelier@gmail.com>
To: "Git List" <git@vger.kernel.org>, "Junio C Hamano" <gitster@pobox.com>
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
Sverre Rabbelier <srabbelier@gmail.com>
Subject: [PATCH] blame: make sure that the last line ends in an LF
Date: Mon, 19 Oct 2009 22:06:28 -0500 [thread overview]
Message-ID: <1256007988-13321-1-git-send-email-srabbelier@gmail.com> (raw)
From: Johannes Schindelin <johannes.schindelin@gmx.de>
This is convenient when parsing multiple the blame of multiple files,
for example:
git ls-files -z --exclude-standard -- "*.[ch]" |
xargs --null -n 1 git blame -p > output
and then analyzing the 'output' file using a seperate script.
Currently the parsing is difficult when not all files have a newline
at EOF, this patch ensures that even such files have a newline at the
end of the blame output.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
CC: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Patch by Dscho, commit message by me. Apologies to Dscho for
taking so long to send it :).
builtin-blame.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/builtin-blame.c b/builtin-blame.c
index 7512773..dd16b22 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -1604,6 +1604,9 @@ static void emit_porcelain(struct scoreboard *sb, struct blame_entry *ent)
} while (ch != '\n' &&
cp < sb->final_buf + sb->final_buf_size);
}
+
+ if (sb->final_buf_size && cp[-1] != '\n')
+ putchar('\n');
}
static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
@@ -1667,6 +1670,9 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
} while (ch != '\n' &&
cp < sb->final_buf + sb->final_buf_size);
}
+
+ if (sb->final_buf_size && cp[-1] != '\n')
+ putchar('\n');
}
static void output(struct scoreboard *sb, int option)
--
1.6.5.1.123.ge01f7
next reply other threads:[~2009-10-20 3:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-20 3:06 Sverre Rabbelier [this message]
2009-10-20 7:00 ` [PATCH] blame: make sure that the last line ends in an LF Junio C Hamano
2009-10-20 13:15 ` Sverre Rabbelier
2009-10-20 16:55 ` Junio C Hamano
2009-10-20 19:55 ` Johannes Schindelin
2009-10-20 22:00 ` Junio C Hamano
2009-10-20 20:04 ` Sverre Rabbelier
2009-10-20 20:28 ` Junio C Hamano
2009-10-22 1:33 ` Sverre Rabbelier
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=1256007988-13321-1-git-send-email-srabbelier@gmail.com \
--to=srabbelier@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
/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).