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

Re: [RFC/PATCH 0/3] git log --pretty=lua

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Sep 25, 2012, 11:22 UTC
Message-ID
<CACsJy8Bs4P7R7m7uAqHYdmrXJA1RQmuoC7ybJFHWhW=efffQyw@mail.gmail.com>
In-Reply-To
<20120925002325.GA19560@sigill.intra.peff.net>
On Tue, Sep 25, 2012 at 7:23 AM, Jeff King <peff@peff.net> wrote:
Show 9 quoted lines
> We've talked off and on about extending the --pretty=format specifiers
> to something more flexible. There's also been talk recently of more
> flexible commit-filtering (e.g., grepping individual notes).  Rather
> than invent a new Turing-complete language, I thought I'd try building
> on somebody else's work by embedding an existing language.
>
> Why Lua? I don't especially like it as a language. But it's designed for
> this purpose, which makes it very lightweight and relatively simple to
> embed.
Personally I'd prefer a Scheme variant.
> The syntax, on the other hand...yuck.
Oops. Scheme is out then.
> One thing that makes Lua
> horrible for this use is that it does not have interpolated strings.
> However, there are template libraries for Lua, so maybe there's
> something there.

For --pretty, the first thing I looked up was utf-8 support and Lua does not seem to have that built in. Libraries can help but it'll be more verbose than native language support.

> And a "4/3" patch would probably add "--lua-filter" as a revision option
> for limiting commits.

I was thinking of nearly the same thing, except that I hide the filters behind sha-1 extended syntax. Users can link <sha-1>@{foo} to a lua function, for example.

I wonder what areas in git might benefit from such a scripting language, and whether someday we would convert some of git builtin commands to $NEWLANG, if $NEWLANG proves easier to maintain for complex logic commands. grep and rev-list (searching in general) are probably where $NEWLANG shines. But for really complex searches, one may want to go with libgit2 or other bindings to their favourite language than one git may provide. gitignore and gitattributes can make use of $NEWLANG but it has to be really fast. There was talk about conditionals in config file, which $NEWLANG might also help.

In general I'm quite happy with what git provides. There are many advanced features that I have never used/or even aware of.

-- 
Duy
Previous: Jeff KingNext: Stephen Bash
Message 11 of 15 in “git log --pretty=lua”
  1. 0/3 git log --pretty=luaJeff King, Sep 25, 2012
  2. 1/3 pretty: make some commit-parsing helpers more publicJeff King, Sep 25, 2012
  3. 2/3 add basic lua infrastructureJeff King, Sep 25, 2012
  4. Nguyen Thai Ngoc DuySep 25, 2012
  5. Jeff KingSep 25, 2012
  6. Robin H. JohnsonSep 25, 2012
  7. Jeff KingSep 25, 2012
  8. Junio C HamanoSep 25, 2012
  9. 3/3 add a "lua" pretty formatJeff King, Sep 25, 2012
  10. Jeff KingOct 6, 2012
  11. Nguyen Thai Ngoc DuySep 25, 2012
  12. Stephen BashSep 25, 2012
  13. Matthieu MoySep 25, 2012
  14. Junio C HamanoSep 25, 2012
  15. Nguyen Thai Ngoc DuySep 30, 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.