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

[PATCH 0/4] fix const issues in revision parser

From
Jeff King <peff@peff.net>
Date
Mar 26, 2026, 19:02 UTC
Message-ID
<20260326190243.GA412983@coredump.intra.peff.net>
In-Reply-To
<20260326174204.GC2447148@coredump.intra.peff.net>
On Thu, Mar 26, 2026 at 01:42:04PM -0400, Jeff King wrote:
Show 9 quoted lines
> IMHO the right solution here is to teach the revision-parser not to
> touch the incoming buffers. We do it only to tie off strings, which can
> mostly be replaced with xmemdupz(). That's slightly less efficient, but
> I don't think it would be measurable (it's one allocation that tends to
> happen a handful of times per program execution, and the rest of the
> parsing is going to allocate things like commit structs anyway).
> 
> I have some patches in that direction, but I haven't gotten around to
> polishing them yet.

Here it is. There were a few oddities to untangle, but I think the result makes the whole thing a bit easier to understand. I may be biased as the author, though. ;)

  [1/4]: revision: make handle_dotdot() interface less confusing
  [2/4]: rev-parse: simplify dotdot parsing
  [3/4]: revision: avoid writing to const string for parent marks
  [4/4]: rev-parse: avoid writing to const string for parent marks
 builtin/rev-parse.c | 40 +++++++++++++--------------
 revision.c          | 67 +++++++++++++++++++++++----------------------
 2 files changed, 54 insertions(+), 53 deletions(-)
-Peff
Previous: Jeff KingNext: Jeff King
Message 7 of 24 in “ISOC23: quell warnings on discarding const”
  1. 0/6 ISOC23: quell warnings on discarding constMichael J Gruber, Mar 26, 2026
  2. 5/6 do not discard const: keep signatureMichael J Gruber, Mar 26, 2026
  3. Junio C HamanoMar 26, 2026
  4. 6/6 do not discard const: the ugly truthMichael J Gruber, Mar 26, 2026
  5. Junio C HamanoMar 26, 2026
  6. Jeff KingMar 26, 2026
  7. 0/4 fix const issues in revision parserJeff King, Mar 26, 2026
  8. 1/4 revision: make handle_dotdot() interface less confusingJeff King, Mar 26, 2026
  9. Junio C HamanoMar 26, 2026
  10. Jeff KingMar 26, 2026
  11. Junio C HamanoMar 27, 2026
  12. 2/4 rev-parse: simplify dotdot parsingJeff King, Mar 26, 2026
  13. 3/4 revision: avoid writing to const string for parent marksJeff King, Mar 26, 2026
  14. 4/4 rev-parse: avoid writing to const string for parent marksJeff King, Mar 26, 2026
  15. 1/6 do not discard const: the simple casesMichael J Gruber, Mar 26, 2026
  16. Jeff KingMar 26, 2026
  17. Junio C HamanoMar 26, 2026
  18. config: store allocated string in non-const pointerJeff King, Mar 26, 2026
  19. 4/6 do not discard const: declare const where we stay constMichael J Gruber, Mar 26, 2026
  20. 2/6 do not discard const: make git-compat-util ISOC23-likeMichael J Gruber, Mar 26, 2026
  21. 3/6 do not discard const: adjust to non-const data typesMichael J Gruber, Mar 26, 2026
  22. Junio C HamanoMar 26, 2026
  23. D. Ben KnobleMar 26, 2026
  24. Michael J GruberMar 27, 2026

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.