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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <jrnieder@xxxxxxxxx>

Thanks for a pleasant read.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]