diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2007-10-15 14:52:25 +0100 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-10-15 21:59:40 -0400 |
commit | ccfc02a30057a5fa7376e1fc8e8c3fe5478556f4 (patch) | |
tree | 4778f545061c2d753b135556e7423841e8dcf517 /transport.c | |
parent | f539d0d6c1f0b4431c0711e290d1f5a7205ed6e6 (diff) | |
download | git-ccfc02a30057a5fa7376e1fc8e8c3fe5478556f4.tar.gz |
Fix compilation when NO_CURL is defined
There were a few places which did not cope well without curl. This
fixes all of them. We still need to link against the walker.o part
of the library as some parts of transport.o still call into there
even though we don't have HTTP support enabled.
If compiled with NO_CURL=1 we now get the following useful error
message:
$ git-fetch http://www.example.com/git
error: git was compiled without libcurl support.
fatal: Don't know how to fetch from http://www.example.com/git
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/transport.c b/transport.c index 6fe6ec8503..46da754078 100644 --- a/transport.c +++ b/transport.c @@ -1,7 +1,9 @@ #include "cache.h" #include "transport.h" #include "run-command.h" +#ifndef NO_CURL #include "http.h" +#endif #include "pkt-line.h" #include "fetch-pack.h" #include "walker.h" @@ -368,6 +370,7 @@ static int disconnect_walker(struct transport *transport) return 0; } +#ifndef NO_CURL static int curl_transport_push(struct transport *transport, int refspec_nr, const char **refspec, int flags) { const char **argv; int argc; @@ -400,7 +403,6 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons return !!err; } -#ifndef NO_CURL static int missing__target(int code, int result) { return /* file:// URL -- do we ever use one??? */ @@ -504,21 +506,6 @@ static int fetch_objs_via_curl(struct transport *transport, return fetch_objs_via_walker(transport, nr_objs, to_fetch); } -#else - -static struct ref *get_refs_via_curl(const struct transport *transport) -{ - die("Cannot fetch from '%s' without curl ...", transport->url); - return NULL; -} - -static int fetch_objs_via_curl(struct transport *transport, - int nr_objs, struct ref **to_fetch) -{ - die("Cannot fetch from '%s' without curl ...", transport->url); - return -1; -} - #endif struct bundle_transport_data { @@ -733,9 +720,13 @@ struct transport *transport_get(struct remote *remote, const char *url) } else if (!prefixcmp(url, "http://") || !prefixcmp(url, "https://") || !prefixcmp(url, "ftp://")) { +#ifdef NO_CURL + error("git was compiled without libcurl support."); +#else ret->get_refs_list = get_refs_via_curl; ret->fetch = fetch_objs_via_curl; ret->push = curl_transport_push; +#endif ret->disconnect = disconnect_walker; } else if (is_local(url) && is_file(url)) { |