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

Re: [PATCH] update-ref --stdin: use skip_prefix()

From
Jeff King <peff@peff.net>
Date
Jun 4, 2018, 03:39 UTC
Message-ID
<20180604033955.GB14451@sigill.intra.peff.net>
In-Reply-To
<20180603143651.6844-1-szeder.dev@gmail.com>
On Sun, Jun 03, 2018 at 04:36:51PM +0200, SZEDER Gábor wrote:
> Use skip_prefix() instead of starts_with() and strcmp() when parsing
> 'git update-ref's stdin to avoid a couple of magic numbers.

I was coincidentally looking at this the other day also noticed these. Thanks for cleaning it up (and your patch looks obviously correct).

I also found it funny that we read the whole input into a buffer and parse from there, rather than using strbuf_getline(). But that's intentional due to e23d84350a (update-ref --stdin: read the whole input at once, 2014-04-07). I think the line-oriented protocol actually can be easily read like that, but the "-z" format ends up having to do awkward reads.

Anyway, sort of a tangent, but I didn't want anybody else looking at this having to dig down the same hole I did. ;)

-Peff
Previous: SZEDER Gábor
Message 2 of 2 in “update-ref --stdin: use skip_prefix()”
  1. update-ref --stdin: use skip_prefix()SZEDER Gábor, Jun 3, 2018
  2. Jeff KingJun 4, 2018

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.