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