Git development
 help / color / mirror / Atom feed
* cosmetic bug: "git show --pretty:format" produces different output than "git show --format"
@ 2015-01-15 13:55 Francesc Zacarias
  2015-01-15 16:23 ` Michael J Gruber
  0 siblings, 1 reply; 4+ messages in thread
From: Francesc Zacarias @ 2015-01-15 13:55 UTC (permalink / raw)
  To: git

Hi!

I noticed that git produces differing output for
"git show --pretty:format show" and "git show --format", even though
the man page says that both are equivalent.
"git show --format" always appends an empty line at the end. The only
way I've found to get rid of that empty line in --format is by adding
-s option.

So, "git show --pretty:format" and "git show -s --format" do produce
the same output.

I can reproduce this issue in Ubuntu Trusty (git version 1.9.1) and
Debian Jessie (git version 2.1.4).

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

* Re: cosmetic bug: "git show --pretty:format" produces different output than "git show --format"
  2015-01-15 13:55 cosmetic bug: "git show --pretty:format" produces different output than "git show --format" Francesc Zacarias
@ 2015-01-15 16:23 ` Michael J Gruber
  2015-01-15 17:39   ` Junio C Hamano
  2015-01-15 19:25   ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Michael J Gruber @ 2015-01-15 16:23 UTC (permalink / raw)
  To: Francesc Zacarias, git

Francesc Zacarias schrieb am 15.01.2015 um 14:55:
> Hi!
> 
> I noticed that git produces differing output for
> "git show --pretty:format show" and "git show --format", even though
> the man page says that both are equivalent.
> "git show --format" always appends an empty line at the end. The only
> way I've found to get rid of that empty line in --format is by adding
> -s option.
> 
> So, "git show --pretty:format" and "git show -s --format" do produce
> the same output.
> 
> I can reproduce this issue in Ubuntu Trusty (git version 1.9.1) and
> Debian Jessie (git version 2.1.4).
> 

The first part of the man page is a bit sloppy, but refers to the FORMAT
section. There, it says that "--pretty" is equivalent to
"--pretty=tformat:" which is different from "--pretty=format:".

Unfortunately, "--format" seems to be parsed as ("--pretty" and
therefore?) "--pretty=tformat:" which I consider a bug.

Michael

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

* Re: cosmetic bug: "git show --pretty:format" produces different output than "git show --format"
  2015-01-15 16:23 ` Michael J Gruber
@ 2015-01-15 17:39   ` Junio C Hamano
  2015-01-15 19:25   ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2015-01-15 17:39 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Francesc Zacarias, git

Michael J Gruber <git@drmicha.warpmail.net> writes:

> Unfortunately, "--format" seems to be parsed as ("--pretty" and
> therefore?) "--pretty=tformat:" which I consider a bug.

"tformat:" was introduced to fix "format:, because many people found
the latter hard to use, probably because most of the time they
wanted to use the feature to show one-line-per-commit and a LF after
each record ("terminator semantics" where 't' in "tformat:" comes
from) made more sense in that context, compared to a LF between each
record ("delimiter semantics").

Of course, "format:" that uses the delimiter semantics has its uses;
after all, the delimiter semantics is what is used for canned
formats, other than --oneline.

It was a deliberate design decision to make "--format=<string>" as a
short-hand for "--pretty=tformat:<string>", favouring "tformat:"
over "format:", AFAIK.  To use the facility to show a break between
each (likely multi-line) record, use "--pretty=format:<string>", not
"--pretty=tformat:<string>" aka "--format=<string>".

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

* Re: cosmetic bug: "git show --pretty:format" produces different output than "git show --format"
  2015-01-15 16:23 ` Michael J Gruber
  2015-01-15 17:39   ` Junio C Hamano
@ 2015-01-15 19:25   ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2015-01-15 19:25 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Francesc Zacarias, git

Michael J Gruber <git@drmicha.warpmail.net> writes:

> The first part of the man page is a bit sloppy, but refers to the FORMAT
> section. There, it says that "--pretty" is equivalent to
> "--pretty=tformat:" which is different from "--pretty=format:".

It is indeed sloppy.  It says --(pretty|format)=<format> can take
these canned <format>s or 'format:<string>', but

 - it does not say it can also take 'tformat:<string>' at all; and

 - it does not say a <format> that is none of the above is dwimmed
   with 'tformat:' prefixed.

Perhaps something like this is needed.


 Documentation/pretty-options.txt | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Documentation/pretty-options.txt b/Documentation/pretty-options.txt
index 8569e29..7e17af9 100644
--- a/Documentation/pretty-options.txt
+++ b/Documentation/pretty-options.txt
@@ -3,9 +3,13 @@
 
 	Pretty-print the contents of the commit logs in a given format,
 	where '<format>' can be one of 'oneline', 'short', 'medium',
-	'full', 'fuller', 'email', 'raw' and 'format:<string>'.  See
-	the "PRETTY FORMATS" section for some additional details for each
-	format.  When omitted, the format defaults to 'medium'.
+	'full', 'fuller', 'email', 'raw', 'format:<string>'
+	and 'tformat:<string>'.  When '<format>' is none of the above,
+	acts as if '--pretty=tformat:<format>' were given.
++
+See
+the "PRETTY FORMATS" section for some additional details for each
+format.  When omitted, the format defaults to 'medium'.
 +
 Note: you can specify the default pretty format in the repository
 configuration (see linkgit:git-config[1]).

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

end of thread, other threads:[~2015-01-15 19:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-15 13:55 cosmetic bug: "git show --pretty:format" produces different output than "git show --format" Francesc Zacarias
2015-01-15 16:23 ` Michael J Gruber
2015-01-15 17:39   ` Junio C Hamano
2015-01-15 19:25   ` 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