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

[PATCH/RFC 0/9] add long forms for format placeholders

From
Will Palmer <wmpalmer@gmail.com>
Date
Mar 28, 2011, 23:17 UTC
Message-ID
<1301354251-23380-1-git-send-email-wmpalmer@gmail.com>

I've been kicking around this series for a while now as part of a larger effort of refactoring the pretty formats. A recent discussion on the list has lead me to believe that this smaller subset may be of use sooner, rather than later.

This series attempts to add "long forms" for common format placeholders in the "git log" family of commands, making the way for yet more placeholders to be added without needing to worry too much about the increasingly limited set of available one-letter mnemonics. It also moves towards the possibility of eventual unification with the format options in for-each-ref.

For example: after this series, in place of %ad, %at, etc you would be able to use %(authordate), %(authordate:unix), etc.

There are some changes in this series which may not seem justified at this point, most noticeably the splitting of user-defined format processing into separate "parse" and "format" stages. This is done to allow for more-complicated formats to be defined, especially conditional formats. Examples of these are not yet included in this series, because this series only includes those parts related to allowing for the "long form" placeholders. If this series needs to go through a few cycles before it's ready for inclusion, examples more-complicated formats may find their way into the series.

The primary purpose of the series is to allow new placeholders to be defined without worrying about the increasingly diminishing set of available one-or-two-letter mnemonics.

Cc: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>
Will Palmer (9):
  mention --date=raw in rev-list and blame help
  add support for --date=unix to complement %at
  interpret %C(invalid) as we would %%C(invalid)
  add sanity length check to format_person_part
  refactor pretty.c into "parse" and "format" steps
  add long-form %(wrap:...) for %w(...)
  add long form %(color:...) for %C(...)
  add long forms %(authordate) and %(committerdate)
  add long forms for author and committer identity
 .gitignore                         |    1 +
 Documentation/blame-options.txt    |    4 +-
 Documentation/git-rev-list.txt     |    2 +-
 Documentation/pretty-formats.txt   |   51 ++-
 Documentation/rev-list-options.txt |    4 +-
 Makefile                           |    1 +
 builtin/blame.c                    |    3 +
 cache.h                            |    5 +-
 color.c                            |   17 +-
 color.h                            |    1 +
 commit.h                           |   84 ++++
 date.c                             |   61 ++-
 pretty.c                           |  947 +++++++++++++++++++++++++++---------
 test-pretty.c                      |  250 ++++++++++
 14 files changed, 1164 insertions(+), 267 deletions(-)
 create mode 100644 test-pretty.c
-- 
1.7.4.2
Next: Will Palmer
Message 1 of 14 in “add long forms for format placeholders”
  1. 0/9 add long forms for format placeholdersWill Palmer, Mar 28, 2011
  2. 1/9 mention --date=raw in rev-list and blame helpWill Palmer, Mar 28, 2011
  3. 2/9 add support for --date=unix to complement %atWill Palmer, Mar 28, 2011
  4. 3/9 interpret %C(invalid) as we would %%C(invalid)Will Palmer, Mar 28, 2011
  5. 4/9 add sanity length check to format_person_partWill Palmer, Mar 28, 2011
  6. 5/9 refactor pretty.c into "parse" and "format" stepsWill Palmer, Mar 28, 2011
  7. 6/9 add long-form %(wrap:...) for %w(...)Will Palmer, Mar 28, 2011
  8. 7/9 add long form %(color:...) for %C(...)Will Palmer, Mar 28, 2011
  9. 8/9 add long forms %(authordate) and %(committerdate)Will Palmer, Mar 28, 2011
  10. 9/9 add long forms for author and committer identityWill Palmer, Mar 28, 2011
  11. Junio C HamanoMar 29, 2011
  12. Will PalmerMar 29, 2011
  13. Michael J GruberMar 29, 2011
  14. Will PalmerMar 29, 2011

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.