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

Re: [PATCH] log --oneline: put decoration at the end of the line

From
Jeff King <peff@peff.net>
Date
Sep 19, 2012, 18:20 UTC
Message-ID
<20120919182039.GE11699@sigill.intra.peff.net>
In-Reply-To
<1348055540-13774-1-git-send-email-pclouds@gmail.com>
On Wed, Sep 19, 2012 at 06:52:20PM +0700, Nguyen Thai Ngoc Duy wrote:
> I find it easier to read "git log --oneline" when the subject lines
> align, which they don't when the log is decorated because the
> decoration stands before the subject line.

I like it. I turned on log.decorate some time ago, and I always felt that --oneline was a little bit messy. But for some reason I never thought of this simple change.

> I'm on colored output so moving decoration to the end of line does not
> make it harder to recognize refs. What about black-and-white people?

Like you, I use colors. I think the decorations would be much harder to see if not for the color.

We should also consider briefly whether anybody is relying on --oneline for machine parsing. I think "log --oneline" is fair game, but I wonder if people calling "rev-list --decorate --oneline" should be considered. It seems kind of unlikely to me, considering that the decorate output is ambiguous to parse anyway (if you see parentheses, you cannot tell if it is decorate output or part of the commit subject).

I did not look too carefully at your patch, but I did notice an odd behavior with it. Try "git log --graph --oneline" in git.git. With stock git, I see this several lines down (apologies for the long lines):

  * | | | | | | | | | | | | | | | | | | | | | | | |   b1379ba Merge branch 'sb/send-email-reconfirm-fix'
  |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  
  | | |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|/ / / /  
  | |/| | | | | | | | | | | | | | | | | | | | | | |   
  | * | | | | | | | | | | | | | | | | | | | | | | | 6183749 (origin/sb/send-email-reconfirm-fix) send-email: initial_to and initial_reply_to are both optional

In other words, 6183749 looks fine: graph, decorations, then subject, all on the same line. But with your patch, I see:

  * | | | | | | | | | | | | | | | | | | | | | | | |   b1379ba Merge branch 'sb/send-email-reconfirm-fix'
  |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  
  | | |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|/ / / /  
  | |/| | | | | | | | | | | | | | | | | | | | | | |   
  | * | | | | | | | | | | | | | | | | | | | | | | | 6183749 send-email: initial_to and initial_reply_to are both optional
  | | |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|/ / / /  
  | |/| | | | | | | | | | | | | | | | | | | | | |    (origin/sb/send-email-reconfirm-fix)

The decoration is broken onto a separate line (with a newline in between). Oddly, if I start my log right at b1379ba, it looks OK. Which makes me think we are hitting some kind of line-wrapping code related to the width of the graph.

-Peff
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 2 of 21 in “log --oneline: put decoration at the end of the line”
  1. log --oneline: put decoration at the end of the lineNguyễn Thái Ngọc Duy, Sep 19, 2012
  2. Jeff KingSep 19, 2012
  3. Junio C HamanoSep 19, 2012
  4. Jeff KingSep 19, 2012
  5. Junio C HamanoSep 19, 2012
  6. Jeff KingSep 19, 2012
  7. Junio C HamanoSep 20, 2012
  8. Nguyen Thai Ngoc DuySep 20, 2012
  9. 0/2 New pretty format color specifiers %C+ and %C-Nguyễn Thái Ngọc Duy, Sep 20, 2012
  10. 1/2 pretty: share code between format_decoration and show_decorationsNguyễn Thái Ngọc Duy, Sep 20, 2012
  11. 2/2 pretty: support placeholders %C+ and %C-Nguyễn Thái Ngọc Duy, Sep 20, 2012
  12. Nguyen Thai Ngoc DuySep 20, 2012
  13. Junio C HamanoSep 20, 2012
  14. Nguyen Thai Ngoc DuySep 21, 2012
  15. Junio C HamanoSep 21, 2012
  16. Junio C HamanoSep 23, 2012
  17. Jeff KingSep 25, 2012
  18. Nguyen Thai Ngoc DuySep 21, 2012
  19. Junio C HamanoSep 20, 2012
  20. Junio C HamanoSep 20, 2012
  21. Nguyen Thai Ngoc DuySep 21, 2012

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.