git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH] revision.c: add --format option for 'git log'

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 22, 2009, 17:53 UTC
Message-ID
<7v63j2z7bh.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<94a0d4530902220918oc6f8ab9vc1fd0b55cad014a2@mail.gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 14 quoted lines
> On Sun, Feb 22, 2009 at 6:49 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>
>>> --format=:foo is a shorthand for --pretty=tformat:foo, otherwise this
>>> new option acts just like --pretty=foo, except it's more intuitive for
>>> users of 'git log'.
>>
>> It's been quite a long time since the earlier discussion, but I wonder why
>> you need the colon before "foo" for this new shorthand.  I *think* you are
>> also introducing "--format=short" as a synonym to "--pretty=short", but
>> I do not think it is necessary.
>
> Well, my hope was to replace --pretty=short with --format=short, but
> you said that would break other scripts.

It is not just scripts you break. You also break people's trained fingers.

You can specify the kind of canned pretty printing with --pretty=short, and it is not any longer to type than --format. For use in scripts that you write once and forget, there is no need to even apply this patch.

The only reason why new --format=<fmt> could be an useful addition is because --pretty=format:<fmt> may be too long to type interactively.

Show 7 quoted lines
>>> As discussed in the mailing list, this is implemented as an undocumented
>>> option.
>>
>> Maybe somebody wants to document it.
>
> Ah, I would gladly add the documentation, shall I write that it's an
> 'alternative' option similar to --pretty?

I do not think we want to introduce a new way to say the same thing for the canned short options; "alternative" is not a good word for it.

Putting it in another way...

The output format is controlled by --pretty, which knows a set of canned output formats. You can specify --format=<fmt> if you want something different from any of the canned format. If your git does not support this new notation, you can say --pretty=tformat:<fmt> to get the same effect. The old --pretty=tformat:<fmt> (and --pretty=format:<fmt>) is not deprecated in any way.

Previous: Felipe ContrerasNext: Junio C Hamano
Message 4 of 23 in “revision.c: add --format option for 'git log'”
  1. revision.c: add --format option for 'git log'Felipe Contreras, Feb 21, 2009
  2. Junio C HamanoFeb 22, 2009
  3. Felipe ContrerasFeb 22, 2009
  4. Junio C HamanoFeb 22, 2009
  5. Junio C HamanoFeb 22, 2009
  6. Felipe ContrerasFeb 22, 2009
  7. Junio C HamanoFeb 22, 2009
  8. Felipe ContrerasFeb 22, 2009
  9. Junio C HamanoFeb 23, 2009
  10. Felipe ContrerasFeb 24, 2009
  11. Felipe ContrerasFeb 24, 2009
  12. Junio C HamanoFeb 24, 2009
  13. Nanako ShiraishiFeb 24, 2009
  14. Junio C HamanoFeb 24, 2009
  15. Felipe ContrerasFeb 24, 2009
  16. Add --format that is a synonym to --prettyNanako Shiraishi, Feb 24, 2009
  17. Jeff KingFeb 24, 2009
  18. Junio C HamanoFeb 24, 2009
  19. Jeff KingFeb 24, 2009
  20. Felipe ContrerasFeb 24, 2009
  21. Linus TorvaldsFeb 22, 2009
  22. Jakub NarebskiFeb 22, 2009
  23. Wincent ColaiutaFeb 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.