diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-06-11 22:10:55 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-06-13 00:41:21 -0700 |
commit | 4234a76167b12a7669dae0e6386c62e712b9dcf5 (patch) | |
tree | 2efdea243725af5fc7f5977decc94b27b261aa76 /cache.h | |
parent | 80583c0ef61cc966c7eee79cf3623a83197e19b8 (diff) | |
download | git-4234a76167b12a7669dae0e6386c62e712b9dcf5.tar.gz git-4234a76167b12a7669dae0e6386c62e712b9dcf5.tar.xz |
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>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -235,7 +235,10 @@ extern void verify_non_filename(const char *prefix, const char *name); #define ALLOC_GROW(x, nr, alloc) \ do { \ if ((nr) >= alloc) { \ - alloc = alloc_nr(alloc); \ + if (alloc_nr(alloc) < (nr)) \ + alloc = (nr); \ + else \ + alloc = alloc_nr(alloc); \ x = xrealloc((x), alloc * sizeof(*(x))); \ } \ } while(0) |