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

Re: [RFC PATCH] show decorations at the end of the line

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Feb 13, 2017, 19:33 UTC
Message-ID
<CA+55aFy-vvOBu5Y4KDeteUyK-7U7yTa1HoqHo+hME1=8bq7Xhw@mail.gmail.com>
In-Reply-To
<xmqq1sv2fq6m.fsf@gitster.mtv.corp.google.com>
On Mon, Feb 13, 2017 at 12:30 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> An obvious downside is that people (against all recommendations) are
> likely to have written a loose script expecting the --oneline format
> is cast in stone.
Actually, I don't believe that is the case wrt decorations.
Why?

If you script the --oneline format and parse the output, you won't have any decorations at all unless you are crazy (you can set "log.decorations=true", but that will truly screw up any scripting).

And if you actually want decorations, and you're parsing them, you are *not* going to script it with "--oneline --decorations", because the end result is basically impossible to parse already (because it's ambiguous - think about parentheses in the commit message).

So if you actually want decorations for parsing, you'd do something like
   git log --pretty="%h '%D' %s"

which is at least parseable (because now the decoration separator is unconditional.

Yeah, I guess you could use "--decorations --color=always" and then use the color codes to parse the decorations, but that's so complicated as to be unrealistic.

And I considered adding a format string explanation, something along the lines of

 - oneline used to mean "--pretty=%h%d %s", now it means "%h %s%d" instead

but that's actually not true. The "oneline" format was much more complex than that, in that it has special rules for "-g", and it has all those colorization ones too.

           Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 20 in “show decorations at the end of the line”
  1. show decorations at the end of the lineLinus Torvalds, Feb 11, 2017
  2. Linus TorvaldsFeb 11, 2017
  3. Junio C HamanoFeb 13, 2017
  4. Linus TorvaldsFeb 13, 2017
  5. Junio C HamanoFeb 13, 2017
  6. Jeff KingFeb 13, 2017
  7. Junio C HamanoFeb 14, 2017
  8. Jeff KingFeb 15, 2017
  9. Junio C HamanoFeb 18, 2017
  10. Linus TorvaldsFeb 19, 2017
  11. Jacob KellerFeb 19, 2017
  12. Jeff KingFeb 20, 2017
  13. Junio C HamanoFeb 20, 2017
  14. Linus TorvaldsFeb 20, 2017
  15. Junio C HamanoFeb 21, 2017
  16. Linus TorvaldsFeb 21, 2017
  17. Jeff KingFeb 21, 2017
  18. Junio C HamanoFeb 21, 2017
  19. Jeff KingFeb 21, 2017
  20. Stephan BeyerFeb 14, 2017

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.