Jonathan Nieder <[email protected]> writes:
> Jonathan Tan wrote:
>
>> --- a/connect.c
>> +++ b/connect.c
>> @@ -172,8 +173,24 @@ struct ref **get_remote_heads(int in, char *src_buf,
>> size_t src_len,
>> continue;
>> }
>>
>> + if (!strcmp(name, "capabilities^{}")) {
>> + if (saw_response)
>> + warning("protocol error: unexpected
>> capabilities^{}, "
>> + "continuing anyway");
>
> Please use die() for these.
> ...
> The rest looks good.
Will squash this in, then.
connect.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/connect.c b/connect.c
index df25d21..5ccbd10 100644
--- a/connect.c
+++ b/connect.c
@@ -175,11 +175,9 @@ struct ref **get_remote_heads(int in, char *src_buf,
size_t src_len,
if (!strcmp(name, "capabilities^{}")) {
if (saw_response)
- warning("protocol error: unexpected
capabilities^{}, "
- "continuing anyway");
+ die("protocol error: unexpected
capabilities^{}");
if (got_dummy_ref_with_capabilities_declaration)
- warning("protocol error: multiple
capabilities^{}, "
- "continuing anyway");
+ die("protocol error: multiple capabilities^{}");
got_dummy_ref_with_capabilities_declaration = 1;
continue;
}
@@ -188,8 +186,7 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t
src_len,
continue;
if (got_dummy_ref_with_capabilities_declaration)
- warning("protocol error: unexpected ref after
capabilities^{}, "
- "using this ref and continuing anyway");
+ die("protocol error: unexpected ref after
capabilities^{}");
ref = alloc_ref(buffer + GIT_SHA1_HEXSZ + 1);
oidcpy(&ref->old_oid, &old_oid);