]> git.ipfire.org Git - thirdparty/git.git/commit - cache.h
Extend --pretty=oneline to cover the first paragraph,
authorJunio C Hamano <gitster@pobox.com>
Tue, 12 Jun 2007 05:10:55 +0000 (22:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 13 Jun 2007 07:41:21 +0000 (00:41 -0700)
commit4234a76167b12a7669dae0e6386c62e712b9dcf5
tree2efdea243725af5fc7f5977decc94b27b261aa76
parent80583c0ef61cc966c7eee79cf3623a83197e19b8
Extend --pretty=oneline to cover the first paragraph,

so that an ugly commit message like this can be
handled sanely.

Currently, --pretty=oneline and --pretty=email (hence
format-patch) take and use only the first line of the commit log
message.  This changes them to:

 - Take the first paragraph, where the definition of the first
   paragraph is "skip all blank lines from the beginning, and
   then grab everything up to the next empty line".

 - Replace all line breaks with a whitespace.

This change would not affect a well-behaved commit message that
adheres to the convention of "single line summary, a blank line,
and then body of message", as its first paragraph always
consists of a single line.  Commit messages from different
culture, such as the ones imported from CVS/SVN, can however get
chomped with the existing behaviour at the first linebreak in
the middle of sentence right now, which would become much easier
to see with this change.

The Subject: and --pretty=oneline output would become very long
and unsightly for non-conforming commits, but their messages are
already ugly anyway, and thischange at least avoids the loss of
information.

The Subject: line from a multi-line paragraph is folded using
RFC2822 line folding rules at the places where line breaks were
in the original.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
commit.c