git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kousik Sanagavarapu <five231003@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org,
	Christian Couder <christian.couder@gmail.com>
Subject: Re: [PATCH] t6300: values containing ')' are broken in ref formats
Date: Fri, 8 Nov 2024 23:42:27 +0530	[thread overview]
Message-ID: <Zy5Ui0tHtKL1vYpw@five231003> (raw)
In-Reply-To: <20241108171637.GA548990@coredump.intra.peff.net>

On Fri, Nov 08, 2024 at 12:16:37PM -0500, Jeff King wrote:
> On Fri, Nov 08, 2024 at 09:41:03AM +0530, Kousik Sanagavarapu wrote:
> 
> [...]
> 
> In the meantime yeah, you'd have to spell it as:
> 
>   %(if:equals=%(refname%29)
> 
> which is...deeply unsatisfying.
> 
> I have long dreamed of throwing out all of this format code in favor of
> a recursive parser which generates an actual tree of nodes, and
> implements all of the ref-filter/pretty.c/cat-file format placeholders.

Oh!  I remember this, let me search up the thread...

Quoting you from

	https://lore.kernel.org/git/20230901191639.GA1955435@coredump.intra.peff.net/

    IMHO the code would be a lot easier to work with if the atoms were
    structured as a parse tree with child pointers (especially when you get
    into things like "if" that have sub-expressions). I think one of the
    reasons that used_atom is an array is to de-duplicate repeated mentions
    (so if you formatted "%(foo) %(foo)" it would only have to store the
    computed value once).

    But I think that is the wrong way to optimize it. We shouldn't be
    storing any strings per-atom, but rather walking the parse tree to
    produce a single output buffer. And the values should be cheap to fill
    in, because we should parse the object as necessary up front. This is
    more or less the way the pretty.c parser does it.

> But I think it's a non-trivial task.

True.

  reply	other threads:[~2024-11-08 18:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 18:41 [PATCH] t6300: values containing ')' are broken in ref formats Kousik Sanagavarapu
2024-11-06  1:18 ` Junio C Hamano
2024-11-06  2:25   ` Jeff King
2024-11-06  3:05     ` Junio C Hamano
2024-11-06  3:54       ` Kousik Sanagavarapu
2024-11-06 18:55         ` Jeff King
2024-11-07  2:34           ` Kousik Sanagavarapu
2024-11-06 18:51       ` Jeff King
2024-11-07  2:29         ` Kousik Sanagavarapu
2024-11-07  2:52         ` Junio C Hamano
2024-11-08  4:11           ` Kousik Sanagavarapu
2024-11-08 17:16             ` Jeff King
2024-11-08 18:12               ` Kousik Sanagavarapu [this message]
2024-11-06  2:40   ` Kousik Sanagavarapu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zy5Ui0tHtKL1vYpw@five231003 \
    --to=five231003@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).