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

`format:%>` padding and `git log --graph`

From
Elliott Cable <me@ell.io>
Date
Dec 20, 2015, 16:41 UTC
Message-ID
<CAPZ477ObN53VffNVvHVuqT0MQ2Csu70i0+himmmjvPj1wfXjUQ@mail.gmail.com>

I'm not sure what version the `%>` / `<|` / etc padding showed up in, but they're truly excellent for building beautiful one-line `git log` output.

This may be a long-shot, but, unfortunately, these new formats sort of fall flat in the presence of `git log --graph`: The ‘pad until column’ feature, which when reading the manpage, I desperately hoped *specifically exists* to replace the normal ‘pad with spaces’ in situations where `--graph` adds an un-known number of characters to the start of the line ... unfortunately doesn't seem to work that way.

For instance, here's some truncated output from a basic `--graph`:
    $ git log --graph --abbrev=8 --pretty="tformat:%h %s"
    ...
    * | a4402023 + basic boilerplate for Liability / LiabilityFamily
    * |   32ed6de8 Merge branch 'queueless' into queueless+
    |\ \
    | * \   1e53ea10 (merge misc) Bring in some `bats` fixes, and re-sty
    | |\ \
    | | |/
    | | * c8c270ff (!! new doc) Add rationale for basically *all* of the
Here's what `%>|(16)%h` gives me:
    $ git log --graph --abbrev=8 --pretty="tformat:%>|(16)%h %s"
    ...
    * |         a4402023 + basic boilerplate for Liability / LiabilityFa
    * |           32ed6de8 Merge branch 'queueless' into queueless+
    |\ \
    | * \           1e53ea10 (merge misc) Bring in some `bats` fixes, an
    | |\ \
    | | |/
    | | *         c8c270ff (!! new doc) Add rationale for basically *all
Here's something like what I'd *like* to have seen:
    $ git log --graph --abbrev=8 --pretty="tformat:%>|(16)%h %s"
    ...
    * |     a4402023 + basic boilerplate for Liability / LiabilityFamily
    * |     32ed6de8 Merge branch 'queueless' into queueless+
    |\ \
    | * \   1e53ea10 (merge misc) Bring in some `bats` fixes, and re-sty
    | * \   1e53ea10 (merge misc) Bring in some `bats` fixes, and re-sty
    | |\ \
    | | |/
    | | *   c8c270ff (!! new doc) Add rationale for basically *all* of t
So: Is this nigh-unimplementable? I once [dove into the git-log
source][patch], and I recall the `--graph` code being terrifying; so if
this is difficult to support, I can see why it would be left out.

If I'm off, though, and this is just an oversight, it'd be really neat to see somebody implement it! (=

⁓ ELLIOTTCABLE — fly safe.
  http://ell.io/tt
   [patch]: <http://article.gmane.org/gmane.comp.version-control.git/226387>
Next: Duy Nguyen
Message 1 of 3 in “`format:%>` padding and `git log --graph`”
  1. Elliott CableDec 20, 2015
  2. Duy NguyenDec 22, 2015
  3. Junio C HamanoDec 22, 2015

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.