{"thread":{"id":"10296","subject":"[PATCH] Fix compilation when NO_CURL is defined","startedAt":"2007-10-15T23:48:30Z","lastAt":"2007-10-16T00:05:03Z","messageCount":2,"participants":["Shawn O. Pearce","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"55922","messageId":"20071015234830.GA9694@spearce.org","threadId":"10296","inReplyTo":null,"subject":"[PATCH] Fix compilation when NO_CURL is defined","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-15T23:48:30Z","receivedAt":"2007-10-15T23:48:30Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"From: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\nThere were a few places which did not cope well without curl.  This\nfixes all of them.  We still need to link against the walker.o part\nof the library as some parts of transport.o still call into there\neven though we don't have HTTP support enabled.\n\nIf compiled with NO_CURL=1 we now get the following useful error\nmessage:\n\n  $ git-fetch http://www.example.com/git\n  error: git was compiled without libcurl support.\n  fatal: Don't know how to fetch from http://www.example.com/git\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n\n I think this is a better version of Dscho's original attempt at\n making NO_CURL=YesPlease actually work again with the builtin\n fetch series.\n\n Makefile    |    6 +++---\n transport.c |   23 +++++++----------------\n 2 files changed, 10 insertions(+), 19 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 62bdac6..40f10b7 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -310,7 +310,7 @@ LIB_OBJS = \\\n \talloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \\\n \tcolor.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \\\n \tconvert.o attr.o decorate.o progress.o mailmap.o symlinks.o remote.o \\\n-\ttransport.o bundle.o\n+\ttransport.o bundle.o walker.o\n \n BUILTIN_OBJS = \\\n \tbuiltin-add.o \\\n@@ -528,7 +528,7 @@ else\n \tendif\n \tBUILTIN_OBJS += builtin-http-fetch.o\n \tEXTLIBS += $(CURL_LIBCURL)\n-\tLIB_OBJS += http.o walker.o http-walker.o\n+\tLIB_OBJS += http.o http-walker.o\n \tcurl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)\n \tifeq \"$(curl_check)\" \"070908\"\n \t\tifndef NO_EXPAT\n@@ -905,7 +905,7 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n \t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n \n-$(LIB_OBJS) $(BUILTIN_OBJS) walker.o: $(LIB_H)\n+$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)\n $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)\n $(DIFF_OBJS): diffcore.h\n \ndiff --git a/transport.c b/transport.c\nindex 6fe6ec8..46da754 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1,7 +1,9 @@\n #include \"cache.h\"\n #include \"transport.h\"\n #include \"run-command.h\"\n+#ifndef NO_CURL\n #include \"http.h\"\n+#endif\n #include \"pkt-line.h\"\n #include \"fetch-pack.h\"\n #include \"walker.h\"\n@@ -368,6 +370,7 @@ static int disconnect_walker(struct transport *transport)\n \treturn 0;\n }\n \n+#ifndef NO_CURL\n static int curl_transport_push(struct transport *transport, int refspec_nr, const char **refspec, int flags) {\n \tconst char **argv;\n \tint argc;\n@@ -400,7 +403,6 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons\n \treturn !!err;\n }\n \n-#ifndef NO_CURL\n static int missing__target(int code, int result)\n {\n \treturn\t/* file:// URL -- do we ever use one??? */\n@@ -504,21 +506,6 @@ static int fetch_objs_via_curl(struct transport *transport,\n \treturn fetch_objs_via_walker(transport, nr_objs, to_fetch);\n }\n \n-#else\n-\n-static struct ref *get_refs_via_curl(const struct transport *transport)\n-{\n-\tdie(\"Cannot fetch from '%s' without curl ...\", transport->url);\n-\treturn NULL;\n-}\n-\n-static int fetch_objs_via_curl(struct transport *transport,\n-\t\t\t\t int nr_objs, struct ref **to_fetch)\n-{\n-\tdie(\"Cannot fetch from '%s' without curl ...\", transport->url);\n-\treturn -1;\n-}\n-\n #endif\n \n struct bundle_transport_data {\n@@ -733,9 +720,13 @@ struct transport *transport_get(struct remote *remote, const char *url)\n \t} else if (!prefixcmp(url, \"http://\")\n \t        || !prefixcmp(url, \"https://\")\n \t        || !prefixcmp(url, \"ftp://\")) {\n+#ifdef NO_CURL\n+\t\terror(\"git was compiled without libcurl support.\");\n+#else\n \t\tret->get_refs_list = get_refs_via_curl;\n \t\tret->fetch = fetch_objs_via_curl;\n \t\tret->push = curl_transport_push;\n+#endif\n \t\tret->disconnect = disconnect_walker;\n \n \t} else if (is_local(url) && is_file(url)) {\n-- \n1.5.3.4.1155.gfe96ee\n"},{"id":"55924","messageId":"Pine.LNX.4.64.0710160104120.25221@racer.site","threadId":"10296","inReplyTo":"20071015234830.GA9694@spearce.org","subject":"Re: [PATCH] Fix compilation when NO_CURL is defined","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-16T00:05:03Z","receivedAt":"2007-10-16T00:05:03Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 15 Oct 2007, Shawn O. Pearce wrote:\n\n> From: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\nHehe, hardly ;-)\n\n> There were a few places which did not cope well without curl.  This\n> fixes all of them.  We still need to link against the walker.o part\n> of the library as some parts of transport.o still call into there\n> even though we don't have HTTP support enabled.\n> \n> If compiled with NO_CURL=1 we now get the following useful error\n> message:\n> \n>   $ git-fetch http://www.example.com/git\n>   error: git was compiled without libcurl support.\n>   fatal: Don't know how to fetch from http://www.example.com/git\n> \n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n> ---\n> \n>  I think this is a better version of Dscho's original attempt at\n>  making NO_CURL=YesPlease actually work again with the builtin\n>  fetch series.\n> \n>  Makefile    |    6 +++---\n>  transport.c |   23 +++++++----------------\n>  2 files changed, 10 insertions(+), 19 deletions(-)\n\nNice!\n\nI like it.\n\nCiao,\nDscho\n"}]}