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

Re: [PATCH 3/5] replace strbuf_expand_dict_cb() with strbuf_expand_step()

From
René Scharfe <l.s.r@web.de>
Date
Jun 27, 2023, 16:24 UTC
Message-ID
<68593128-21e8-a728-719c-632fccf740d6@web.de>
In-Reply-To
<20230627083526.GA1273865@coredump.intra.peff.net>
Am 27.06.23 um 10:35 schrieb Jeff King:
Show 11 quoted lines
> On Tue, Jun 27, 2023 at 04:29:02AM -0400, Jeff King wrote:
>
>> Your comment above does make me wonder if strbuf_expand_step() should be
>> quietly handling "%%" itself. But I guess strbuf_expand() doesn't, and
>> your branch.c quote-literal example probably would not want that
>> behavior.
>
> Er, nope, strbuf_expand() does handle "%%" itself. It really feels like
> we'd want strbuf_expand_step() to do so, too, then. Even if we had two
> variants (a "raw" one which doesn't handle "%%" so that branch.c could
> use it, and then another that wrapped it to handle "%%").
strbuf_expand() handles %% and unrecognized placeholders.

We could do that, or move the %% handling to strbuf_expand_literal or something else. E.g. initially I had a strbuf_expand_default that handled %% and unrecognized placeholders.

I think it's a good idea to first get used to the loop paradigm by eschewing the sugary automatic handling and having everything spelled out explicitly. It's just one more branch. Then we can come up with a better factoring after a while.

René
Previous: Jeff KingNext: René Scharfe
Message 12 of 20 in “replace strbuf_expand()”
  1. 0/5 replace strbuf_expand()René Scharfe, Jun 17, 2023
  2. 1/5 pretty: factor out expand_separator()René Scharfe, Jun 17, 2023
  3. 2/5 strbuf: factor out strbuf_expand_step()René Scharfe, Jun 17, 2023
  4. Taylor BlauJun 19, 2023
  5. René ScharfeJun 20, 2023
  6. Taylor BlauJun 21, 2023
  7. Jeff KingJun 27, 2023
  8. René ScharfeJun 27, 2023
  9. 3/5 replace strbuf_expand_dict_cb() with strbuf_expand_step()René Scharfe, Jun 17, 2023
  10. Jeff KingJun 27, 2023
  11. Jeff KingJun 27, 2023
  12. René ScharfeJun 27, 2023
  13. 4/5 replace strbuf_expand() with strbuf_expand_step()René Scharfe, Jun 17, 2023
  14. Jeff KingJun 27, 2023
  15. René ScharfeJun 27, 2023
  16. Jeff KingJun 27, 2023
  17. 5/5 strbuf: simplify strbuf_expand_literal_cb()René Scharfe, Jun 17, 2023
  18. Jeff KingJun 27, 2023
  19. René ScharfeJun 27, 2023
  20. Jeff KingJun 27, 2023

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.