Re: [PATCH 6/6] builtin-commit: Add newline when showing which commit was created

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 6/6] builtin-commit: Add newline when showing which commit was created

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:55

Jeff King [off-list ref] writes:
On Sun, Nov 11, 2007 at 05:36:52PM +0000, Johannes Schindelin wrote:
quoted
The function log_tree_commit() does not break the line, so we have to
do it ourselves.
Johannes,

Can you explain the rationale for this change in more detail?

When I run builtin-commit from the tip of next, I always get an extra
newline (as compared to the shell behavior):
After reverting this, recording a merge commit seems to have lost the
newline.  Can be easily reproduced with:

	$ git merge --no-commit some-branch
        $ git commit -a -m 'foo'

Re: [PATCH 6/6] builtin-commit: Add newline when showing which commit was created

From: Jeff King <hidden>
Date: 2016-06-15 22:43:55

On Sun, Dec 02, 2007 at 11:33:28PM -0800, Junio C Hamano wrote:
After reverting this, recording a merge commit seems to have lost the
newline.  Can be easily reproduced with:

	$ git merge --no-commit some-branch
  $ git commit -a -m 'foo'
See, I knew reverting would flush it out. ;)

Unfortunately, the fix isn't terribly obvious. log_tree_commit produces
output either from log_tree_diff, which appends a newline, or from
show_log, which doesn't, and returns the same value in either case.

I tried adding a '%n' to the format specifier (which is "%h: %s"),
but that has inconsistent results, since another newline is always
placed between the diffstat and the log, anyway. The design of
--pretty=format is a bit inflexible here, since you are stuck with the
"$log\n$diff" format. But changing it would impact users, and is likely
to require a lot of surgery in the log machinery.

So short of munging log_tree_commit to add the newline, I'm not sure how
to fix it, and I'm a little wary of messing with that function.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help