git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Documentation/log: fix description of format.pretty
@ 2012-11-11 11:27 Ramkumar Ramachandra
  2012-11-12  8:05 ` Jonathan Nieder
  0 siblings, 1 reply; 5+ messages in thread
From: Ramkumar Ramachandra @ 2012-11-11 11:27 UTC (permalink / raw)
  To: Git List; +Cc: Jonathan Nieder

59893a88 (Documentation/log: add a CONFIGURATION section, 2010-05-08)
mentioned that `format.pretty` is the default for the `--format`
option.  Such an option never existed, and the author meant
`--pretty`.  Make this correction.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/git-log.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 585dac4..4b07ad4 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -148,7 +148,7 @@ See linkgit:git-config[1] for core variables and
linkgit:git-
 for settings related to diff generation.

 format.pretty::
-       Default for the `--format` option.  (See "PRETTY FORMATS" above.)
+       Default for the `--pretty` option.  (See "PRETTY FORMATS" above.)
        Defaults to "medium".

 i18n.logOutputEncoding::
-- 
1.7.12.1.428.g652398a.dirty

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

* Re: [PATCH] Documentation/log: fix description of format.pretty
  2012-11-11 11:27 [PATCH] Documentation/log: fix description of format.pretty Ramkumar Ramachandra
@ 2012-11-12  8:05 ` Jonathan Nieder
  2012-11-12  9:39   ` Ramkumar Ramachandra
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Nieder @ 2012-11-12  8:05 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git List

Hi Ram,

Ramkumar Ramachandra wrote:

> 59893a88 (Documentation/log: add a CONFIGURATION section, 2010-05-08)
> mentioned that `format.pretty` is the default for the `--format`
> option.  Such an option never existed,

False.  Have you tried it?

Thanks,
Jonathan

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

* Re: [PATCH] Documentation/log: fix description of format.pretty
  2012-11-12  8:05 ` Jonathan Nieder
@ 2012-11-12  9:39   ` Ramkumar Ramachandra
  2012-11-12 15:38     ` Jonathan Nieder
  0 siblings, 1 reply; 5+ messages in thread
From: Ramkumar Ramachandra @ 2012-11-12  9:39 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Git List

Hi Jonathan,

Jonathan Nieder wrote:
> Hi Ram,
>
> Ramkumar Ramachandra wrote:
>
>> 59893a88 (Documentation/log: add a CONFIGURATION section, 2010-05-08)
>> mentioned that `format.pretty` is the default for the `--format`
>> option.  Such an option never existed,
>
> False.  Have you tried it?

Oops, I read about `--pretty` in pretty-formats.txt and didn't realize
that `--format` existed.  However, your patch is still wrong because
there seems to be a subtle (and confusing) difference between
`--pretty` and `--format`.  In the latter, you can't omit the format,
and expect it to be picked up from format.pretty:

  $ git log --format
  fatal: unrecognized argument: --format

Instead, you have to specify the format explicitly:

  $ git log --format=medium

So, we should change the commit message in my patch?

Ram

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

* Re: [PATCH] Documentation/log: fix description of format.pretty
  2012-11-12  9:39   ` Ramkumar Ramachandra
@ 2012-11-12 15:38     ` Jonathan Nieder
  2012-11-12 17:42       ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Nieder @ 2012-11-12 15:38 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git List

Ramkumar Ramachandra wrote:

> Oops, I read about `--pretty` in pretty-formats.txt and didn't realize
> that `--format` existed.  However, your patch is still wrong because
> there seems to be a subtle (and confusing) difference between
> `--pretty` and `--format`.  In the latter, you can't omit the format,
> and expect it to be picked up from format.pretty:
>
>   $ git log --format
>   fatal: unrecognized argument: --format

You can do

	$ git log

and format.pretty will still take effect.  In other words, setting
format.pretty to "foo" is somewhat like making

	$ git log

do

	$ git log --format=foo

which is what the text is supposed to explain.  It is based on the
following text from Documentation/config.txt:

	format.pretty::
		The default pretty format for log/show/whatchanged command,
		See linkgit:git-log[1], linkgit:git-show[1],
		linkgit:git-whatchanged[1].

I do imagine it can be made clearer.  s/--format/--pretty/ does not go
far enough --- it only replaces one confusing explanation with
another.

Hoping that clarifies,
Jonathan

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

* Re: [PATCH] Documentation/log: fix description of format.pretty
  2012-11-12 15:38     ` Jonathan Nieder
@ 2012-11-12 17:42       ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2012-11-12 17:42 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Ramkumar Ramachandra, Git List

Jonathan Nieder <jrnieder@gmail.com> writes:

> Ramkumar Ramachandra wrote:
>
>> Oops, I read about `--pretty` in pretty-formats.txt and didn't realize
>> that `--format` existed.  However, your patch is still wrong because
>> there seems to be a subtle (and confusing) difference between
>> `--pretty` and `--format`.  In the latter, you can't omit the format,
>> and expect it to be picked up from format.pretty:
>>
>>   $ git log --format
>>   fatal: unrecognized argument: --format

We probably should say "--format needs an argument" here.

> ... It is based on the
> following text from Documentation/config.txt:
>
> 	format.pretty::
> 		The default pretty format for log/show/whatchanged command,
> 		See linkgit:git-log[1], linkgit:git-show[1],
> 		linkgit:git-whatchanged[1].
>
> I do imagine it can be made clearer.  s/--format/--pretty/ does not go
> far enough --- it only replaces one confusing explanation with
> another.

The --format and --pretty are more or less the same thing since
3a4c1a5 (Add --format that is a synonym to --pretty, 2009-02-24).
The --format option was added as a synonym because majority of new
users who have never heard of --pretty found it more natural; in
that sense, Ram's patch goes backwards.

The entry in config.txt came from 94c22a5 (log/show/whatchanged:
introduce format.pretty configuration, 2008-03-02) that predates the
synonym, and originally it was to allow

    [format] pretty = fuller

to make "git log" by default use "git log --pretty=fuller" in the
configuration; back then there wasn't a support for custom formats
like

    [format] pretty = "%h %s"

until 3640754 (Give short-hands to --pretty=tformat:%formatstring,
2009-02-24) introduced it.

"The default pretty format" in the description was written to refer
to the original "raw/medium/short/email/full/fuller" set, but these
days, we accept anything that you can write after "--pretty=" (or
its synonym "--format=") on the command line.

This is one of the reasons why I do not want to see abbreviated
descriptions for configuration variables duplicated in the manual
pages of individual commands, as the practice tends to lead to this
kind of confusion.

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

end of thread, other threads:[~2012-11-12 17:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-11 11:27 [PATCH] Documentation/log: fix description of format.pretty Ramkumar Ramachandra
2012-11-12  8:05 ` Jonathan Nieder
2012-11-12  9:39   ` Ramkumar Ramachandra
2012-11-12 15:38     ` Jonathan Nieder
2012-11-12 17:42       ` 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).