Re: [PATCH v2 2/3] transport: introduce transport_has_remote_bundle_uri()

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

 



Toon Claes <toon@xxxxxxxxx> writes:

[snip]

> diff --git a/t/helper/test-bundle-uri.c b/t/helper/test-bundle-uri.c
> index 0c5fa723d8..bd558d5e57 100644
> --- a/t/helper/test-bundle-uri.c
> +++ b/t/helper/test-bundle-uri.c
> @@ -90,7 +90,7 @@ static int cmd_ls_remote(int argc, const char **argv)
>  	}
>
>  	transport = transport_get(remote, NULL);
> -	if (transport_get_remote_bundle_uri(transport) < 0) {
> +	if (!transport_has_remote_bundle_uri(transport)) {
>  		error(_("could not get the bundle-uri list"));
>  		status = 1;
>  		goto cleanup;
> diff --git a/transport.c b/transport.c
> index 12cc5b4d96..1a7d86fa40 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -1536,7 +1536,7 @@ int transport_fetch_refs(struct transport *transport, struct ref *refs)
>  	return rc;
>  }
>
> -int transport_get_remote_bundle_uri(struct transport *transport)
> +static int transport_get_remote_bundle_uri(struct transport *transport)
>

Why make it static?

>  {
>  	int value = 0;
>  	const struct transport_vtable *vtable = transport->vtable;
> @@ -1561,6 +1561,18 @@ int transport_get_remote_bundle_uri(struct transport *transport)
>
>  	if (vtable->get_bundle_uri(transport) < 0)
>  		return error(_("could not retrieve server-advertised bundle-uri list"));
> +
> +	return 0;
> +}
> +
> +int transport_has_remote_bundle_uri(struct transport *transport)
> +{
> +	transport_get_remote_bundle_uri(transport);
> +
> +	if (transport->bundles &&
> +	    hashmap_get_size(&transport->bundles->bundles))
> +		return 1;
> +
>  	return 0;
>  }
>
> diff --git a/transport.h b/transport.h
> index 6393cd9823..5ea9641558 100644
> --- a/transport.h
> +++ b/transport.h
> @@ -294,10 +294,11 @@ const struct ref *transport_get_remote_refs(struct transport *transport,
>  					    struct transport_ls_refs_options *transport_options);
>
>  /**
> - * Retrieve bundle URI(s) from a remote. Populates "struct
> - * transport"'s "bundle_uri" and "got_remote_bundle_uri".
> + * Try fetch bundle URI(s) from a remote and returns 1 if one or more

Nit: s/Try/Try to/

> + * bundle URI(s) are received from the server.
> + * Populates "struct transport"'s "bundles" and "got_remote_bundle_uri".
>   */
> -int transport_get_remote_bundle_uri(struct transport *transport);
> +int transport_has_remote_bundle_uri(struct transport *transport);
>

Shouldn't this now be renamed to `transport_has_bundle_uri`? Earlier, we
were 'getting' bundle URIs from the remote. Now, we are abstracting that
away and simply asking, 'do we have bundle URIs'.

>  /*
>   * Fetch the hash algorithm used by a remote.
> --
> 2.45.2

Attachment: signature.asc
Description: PGP signature


[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]

  Powered by Linux