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

Re: Fwd: [PATCH 2/2] pretty.c: allow date formats in user format strings

From
Jeff King <peff@peff.net>
Date
Mar 7, 2011, 19:26 UTC
Message-ID
<20110307192640.GB20930@sigill.intra.peff.net>
In-Reply-To
<1299523834.1835.17.camel@walleee>
On Mon, Mar 07, 2011 at 06:50:34PM +0000, Will Palmer wrote:
Show 8 quoted lines
> I'm home now, and apparently that should have been:
> https://github.com/wpalmer/git/tree/pretty/parse-format
> 
> I assume the code is very hard to follow, as it was pretty much written
> with the mindset of "get it done now, fix it later". Looking into it
> again, I see that part of the reason I abandoned it was not being able
> to determine a good way to split things into logical commits. It's
> almost entirely an "everything works or nothing works" change.

I haven't looked at your code yet, but the breakdown of patches I would expect / hope for is something like:

  1. introduce infrastructure for creating parse-tree from strbuf_expand
     format, with some tests
  2. port format_commit_* over to new system; I would expect that the
     caller code will have to be part of both the parsing and the
     expansion, since the generic code can't know that "%ad" is
     meaningful (and we want to keep it for backwards compatibility).
     Leave format_commit_message as a parse + expand wrapper for simple
     callers who don't care about speed.
  3. Add generic "%(key:option)" support to the new infrastructure,
     forward-porting format_commit_* as necessary (and hopefully the
     change are minimal...).

So those are all big commits, obviously, but hopefully it lets us review in three stages: does the new infrastructure look good, does porting an existing caller (and probably the most complex caller) clean up the caller code, and then finally, does the new syntax look good?

But of course the devil is in the details, so probably that breakdown has some flaw in it. :) I'll see when I look at your code how close to reality I came.

-Peff
Previous: Will PalmerNext: Will Palmer
Message 11 of 15 in “[Bug] %[a|c]d placeholder does not respect --date= option in combination with git archive”
  1. Dietmar WinklerMar 3, 2011
  2. Jeff KingMar 3, 2011
  3. Dietmar WinklerMar 4, 2011
  4. Jeff KingMar 5, 2011
  5. 1/2 pretty.c: give format_person_part the whole placeholderJeff King, Mar 5, 2011
  6. 2/2 pretty.c: allow date formats in user format stringsJeff King, Mar 5, 2011
  7. Fwd: [PATCH 2/2] pretty.c: allow date formats in user format stringsWill Palmer, Mar 6, 2011
  8. Jeff KingMar 7, 2011
  9. Will PalmerMar 7, 2011
  10. Will PalmerMar 7, 2011
  11. Jeff KingMar 7, 2011
  12. Will PalmerMar 8, 2011
  13. Junio C HamanoMar 9, 2011
  14. Jeff KingMar 10, 2011
  15. Dietmar WinklerMar 11, 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.