Thread (1 message) 1 message, 1 author, 2016-09-09

Re: [PATCH v4 3/3] connect: advertized capability is not a ref

From: Junio C Hamano <hidden>
Date: 2016-09-09 20:40:35
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Jonathan Nieder [off-list ref] writes:
Jonathan Tan wrote:
quoted
--- 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);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help