Re: [PATCH 08/16] use skip_prefix to avoid magic numbers
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 23, 2014, 21:44 UTC
- Message-ID
- <xmqqa993b8so.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20140618194750.GH22622@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 12 quoted lines
> diff --git a/connect.c b/connect.c
> index 94a6650..37ff018 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -140,12 +141,12 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
> if (!len)
> break;
>
> - if (len > 4 && starts_with(buffer, "ERR "))
> - die("remote error: %s", buffer + 4);
> + if (len > 4 && skip_prefix(buffer, "ERR ", &arg))
> + die("remote error: %s", arg);Makes one wonder if we should do something special to a line with only "ERR " and nothing else on it, which the other end may have meant us to give a blank line to make the output more readable.
A fix, if one turns out to be needed, is outside the scope of this patch, though, I think.