* [PATCH] Skip excessive blank lines before commit body
@ 2007-01-03 13:34 Lars Hjemli
2007-01-03 17:03 ` Junio C Hamano
2007-01-04 15:50 ` Andreas Ericsson
0 siblings, 2 replies; 3+ messages in thread
From: Lars Hjemli @ 2007-01-03 13:34 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
This modifies pretty_print_commit() to make the output of git-rev-list and
friends a bit more predictable.
A commit body starting with blank lines might be unheard-of, but still possible
to create using git-commit-tree (so is bound to appear somewhere, sometime).
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
commit.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/commit.c b/commit.c
index 544e426..2a58175 100644
--- a/commit.c
+++ b/commit.c
@@ -703,7 +703,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
const char *after_subject,
int relative_date)
{
- int hdr = 1, body = 0;
+ int hdr = 1, body = 0, seen_title = 0;
unsigned long offset = 0;
int indent = 4;
int parents_shown = 0;
@@ -809,6 +809,8 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
body = 1;
if (is_empty_line(line, &linelen)) {
+ if (!seen_title)
+ continue;
if (!body)
continue;
if (subject)
@@ -817,6 +819,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
break;
}
+ seen_title = 1;
if (subject) {
int slen = strlen(subject);
memcpy(buf + offset, subject, slen);
--
1.5.0.rc0.ge900
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Skip excessive blank lines before commit body
2007-01-03 13:34 [PATCH] Skip excessive blank lines before commit body Lars Hjemli
@ 2007-01-03 17:03 ` Junio C Hamano
2007-01-04 15:50 ` Andreas Ericsson
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-01-03 17:03 UTC (permalink / raw)
To: Lars Hjemli; +Cc: git, Marco Costalba
Lars Hjemli <hjemli@gmail.com> writes:
> This modifies pretty_print_commit() to make the output of
> git-rev-list and friends a bit more predictable.
>
> A commit body starting with blank lines might be unheard-of,
> but still possible to create using git-commit-tree (so is
> bound to appear somewhere, sometime).
This is unfortunately (!!) a good change. By design,
commit-tree should take whatever binary garbage the user throws
at it as-is (there is no requirement for it to be even text),
and the "punchline + LF + body + LF + signoffs" is strictly by
convention. We already reformat using indentations and friends,
so your change is a very sane thing to do.
We might want to tighten the formatting convention enforced at
the Porcelain level -- we can start the process by shipping a
sample commit message hook that checks a well formatted commit
log message, perhaps?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Skip excessive blank lines before commit body
2007-01-03 13:34 [PATCH] Skip excessive blank lines before commit body Lars Hjemli
2007-01-03 17:03 ` Junio C Hamano
@ 2007-01-04 15:50 ` Andreas Ericsson
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Ericsson @ 2007-01-04 15:50 UTC (permalink / raw)
To: Lars Hjemli; +Cc: git, Junio C Hamano
Lars Hjemli wrote:
> This modifies pretty_print_commit() to make the output of git-rev-list and
> friends a bit more predictable.
>
> A commit body starting with blank lines might be unheard-of, but still possible
> to create using git-commit-tree (so is bound to appear somewhere, sometime).
>
Lovely. I was just looking in to doing the exact same thing myself.
For reference, there is a tool somewhere that creates CVS commit
messages with an empty title-line. When imported to git, those empty
lines remain and fuzz up gitk and qgit viewing ad nauseum. I'm guessing
(and hoping) this patch would take care of it.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-01-04 15:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-03 13:34 [PATCH] Skip excessive blank lines before commit body Lars Hjemli
2007-01-03 17:03 ` Junio C Hamano
2007-01-04 15:50 ` Andreas Ericsson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.