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

From: Jonathan Nieder <[email-masked]>
Date: Sun, 29 Aug 2010 16:36:18 -0500

Sverre Rabbelier wrote:

> +++ 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,
[...]
> +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 <[email-masked]>

Thanks for a pleasant read.