Re: [RFC/PATCH 3/6] Move setup of curl remote helper from transport.c to transport-helper.c
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 11, 2009, 12:23 UTC
- Message-ID
- <alpine.DEB.1.00.0908111421290.4638@intel-tinevez-2-302>
- In-Reply-To
- <1249985426-13726-4-git-send-email-johan@herland.net>
Hi,
On Tue, 11 Aug 2009, Johan Herland wrote:
Show 56 quoted lines
> diff --git a/transport-helper.c b/transport-helper.c
> index a901630..d3ce984 100644
> --- a/transport-helper.c
> +++ b/transport-helper.c
> @@ -249,6 +249,34 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
> return ret;
> }
>
> +#ifndef NO_CURL
> +static int curl_transport_push(struct transport *transport, int refspec_nr, const char **refspec, int flags)
> +{
> + const char **argv;
> + int argc;
> +
> + if (flags & TRANSPORT_PUSH_MIRROR)
> + return error("http transport does not support mirror mode");
> +
> + argv = xmalloc((refspec_nr + 12) * sizeof(char *));
> + argv[0] = "http-push";
> + argc = 1;
> + if (flags & TRANSPORT_PUSH_ALL)
> + argv[argc++] = "--all";
> + if (flags & TRANSPORT_PUSH_FORCE)
> + argv[argc++] = "--force";
> + if (flags & TRANSPORT_PUSH_DRY_RUN)
> + argv[argc++] = "--dry-run";
> + if (flags & TRANSPORT_PUSH_VERBOSE)
> + argv[argc++] = "--verbose";
> + argv[argc++] = transport->url;
> + while (refspec_nr--)
> + argv[argc++] = *refspec++;
> + argv[argc] = NULL;
> + return !!run_command_v_opt(argv, RUN_GIT_CMD);
> +}
> +#endif
> +
> int transport_helper_init(struct transport *transport)
> {
> struct helper_data *data = xcalloc(sizeof(*data), 1);
> @@ -269,5 +297,16 @@ int transport_helper_init(struct transport *transport)
> transport->get_refs_list = get_refs_list;
> transport->fetch = fetch;
> transport->disconnect = disconnect_helper;
> +
> + if (!strcmp(data->name, "http")
> + || !strcmp(data->name, "https")
> + || !strcmp(data->name, "ftp")) {
> +#ifdef NO_CURL
> + error("git was compiled without libcurl support.");
> +#else
> + transport->push = curl_transport_push;
> +#endif
> + }
> +
> return 0;
> }I still find it rather, uhm, confusing that copying git-http-push and/or git-remote-http into place will still give you the error message "Git was compiled without libcurl support".
It's just as well that I do not need to maintain RPMs or DEBs.
Ciao, Dscho