Thread (51 messages) flat view 51 messages, 4 authors, 2016-06-15

Re: [PATCH 03/13] transport-helper: factor out push_update_refs_status

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:49:24

Sverre Rabbelier wrote:
quoted hunk ↗ jump to hunk
+++ b/transport-helper.c
@@ -554,6 +554,9 @@ static int fetch(struct transport *transport,
 	return -1;
 }
 
+static void push_update_refs_status(struct helper_data *data,
+				       struct ref *remote_refs);
+
 static int push_refs_with_push(struct transport *transport,
 		struct ref *remote_refs, int flags)
 {
@@ -609,8 +612,17 @@ static int push_refs_with_push(struct transport *transport,
[...]
quoted hunk ↗ jump to hunk
+static void push_update_refs_status(struct helper_data *data,
+				    struct ref *remote_refs)
+{
+	struct strbuf buf = STRBUF_INIT;
+	struct ref *ref = remote_refs;
 	while (1) {
 		char *refname, *msg;
 		int status;
@@ -679,7 +691,7 @@ static int push_refs_with_push(struct transport *transport,
 		ref->remote_status = msg;
 	}
Hmm, I am not too happy with the long loop without explicit condition.
Maybe it would make sense to split out the loop body as its own function?
Something like

	struct ref *ref = remote_refs;
	for (;;) {
		recvline(data, &buf);
		if (!buf.len)
			break;

		push_update_ref_status(&buf, &ref, remote_refs);
	}
 	strbuf_release(&buf);
-	return 0;
+	return;
Not necessary, I think.
 }
Regardless, for what it's worth,

Reviewed-by: Jonathan Nieder <redacted>

Thanks for a pleasant read.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help