git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Missing trailing newline with git log --pretty=format
@ 2009-03-18 21:23 Andreas Gruenbacher
  2009-03-18 21:56 ` Markus Heidelberg
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Gruenbacher @ 2009-03-18 21:23 UTC (permalink / raw)
  To: git

Hello,

with the latest version of git from right now (e986ceb):

While trying to get a reverse list of commit ids, I noticed that git log 
prints newlines between commits, but not at the end. This results in two 
joined lines with:

	$ git log --pretty=format:%h HEAD^^..HEAD | tac
	aab3b9a7d4e3a7
	e986ceb

Any chance of getting this fixed?

Thanks,
Andreas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Missing trailing newline with git log --pretty=format
  2009-03-18 21:23 Missing trailing newline with git log --pretty=format Andreas Gruenbacher
@ 2009-03-18 21:56 ` Markus Heidelberg
  2009-03-18 22:04   ` Andreas Gruenbacher
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Heidelberg @ 2009-03-18 21:56 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: git

Andreas Gruenbacher, 18.03.2009:
> Hello,
> 
> with the latest version of git from right now (e986ceb):
> 
> While trying to get a reverse list of commit ids, I noticed that git log 
> prints newlines between commits, but not at the end. This results in two 
> joined lines with:
> 
> 	$ git log --pretty=format:%h HEAD^^..HEAD | tac
> 	aab3b9a7d4e3a7
> 	e986ceb
> 
> Any chance of getting this fixed?

Use tformat instead of format. Or better for a script use

	$ git rev-list HEAD^^..HEAD

But somehow --abbrev or --abbrev-commit don't work. Am I doing
something wrong?

Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Missing trailing newline with git log --pretty=format
  2009-03-18 21:56 ` Markus Heidelberg
@ 2009-03-18 22:04   ` Andreas Gruenbacher
  2009-03-18 22:27     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Gruenbacher @ 2009-03-18 22:04 UTC (permalink / raw)
  To: markus.heidelberg; +Cc: git

On Wednesday, 18 March 2009 22:56:43 Markus Heidelberg wrote:
> Use tformat instead of format.

Hmm ... didn't know that, thanks. Now I wonder why anyone would ever want 
format instead of tformat ;)

> Or better for a script use 
>
> 	$ git rev-list HEAD^^..HEAD

Much better, thanks.

Andreas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Missing trailing newline with git log --pretty=format
  2009-03-18 22:04   ` Andreas Gruenbacher
@ 2009-03-18 22:27     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2009-03-18 22:27 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: markus.heidelberg, git

Andreas Gruenbacher <agruen@suse.de> writes:

> On Wednesday, 18 March 2009 22:56:43 Markus Heidelberg wrote:
>> Use tformat instead of format.
>
> Hmm ... didn't know that, thanks. Now I wonder why anyone would ever want 
> format instead of tformat ;)

If your payload is multi-line, you would want to see a separating empty
line in between entries, but not after the last one:

	$ command with --format
        The first line of first entry.
        The second line of first entry.
        ...
        The last line of first entry.

        The first line of second entry.
        ...
        ...
        The last line of last entry.
        $ notice there is no extra newline after that

That is what --format does.  One-line-per-entry is a special case.  You do
not want a "separating LF in between entries", but a "terminating LF after
each entry".  T in --tformat stands for this "terminating" aspect, as
opposed to the "separator" behaviour --format gives you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-18 22:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-18 21:23 Missing trailing newline with git log --pretty=format Andreas Gruenbacher
2009-03-18 21:56 ` Markus Heidelberg
2009-03-18 22:04   ` Andreas Gruenbacher
2009-03-18 22:27     ` Junio C Hamano

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).