Skip to contentSkip to conversation

http-push.c: get_remote_object_url() is only used under USE_CURL_MULTI

PATCH In review Junio C Hamano 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 http-push.c: get_remote_object_url() is only used under USE_CURL_MULTI

Otherwise -Wunused-function (which is implied by -Wall) triggers.

---

I think this patch is probably a bit on the wrong side of the borderline, in that it *happens to be* that get_remote_object_url() is used by nobody in non-multi codepath right now, but it is entirely possible that future code clean-up can benefit from its use. But without this patch,, the file does not compile for me (I compile everything with "-Werror -Wall").

 http-push.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
http-push.c +8 -7
index ba5cc32..203c075 100644
@@ -218,13 +218,6 @@ static void append_remote_object_url(struct strbuf *buf, const char *url,
 		strbuf_addf(buf, "%s", hex+2);
 }
 
-static char *get_remote_object_url(const char *url, const char *hex, int only_two_digit_prefix)
-{
-	struct strbuf buf = STRBUF_INIT;
-	append_remote_object_url(&buf, url, hex, only_two_digit_prefix);
-	return strbuf_detach(&buf, NULL);
-}
-
 static void finish_request(struct transfer_request *request);
 static void release_request(struct transfer_request *request);
 
@@ -237,6 +230,14 @@ static void process_response(void *callback_data)
 }
 
 #ifdef USE_CURL_MULTI
+
+static char *get_remote_object_url(const char *url, const char *hex, int only_two_digit_prefix)
+{
+	struct strbuf buf = STRBUF_INIT;
+	append_remote_object_url(&buf, url, hex, only_two_digit_prefix);
+	return strbuf_detach(&buf, NULL);
+}
+
 static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
 			       void *data)
 {
Signature · 1 line
1.6.1.2.343.g53117
#1 lore raw
Quoted 10 lines · Junio C Hamano

Otherwise -Wunused-function (which is implied by -Wall) triggers.

---

I think this patch is probably a bit on the wrong side of the borderline, in that it *happens to be* that get_remote_object_url() is used by nobody in non-multi codepath right now, but it is entirely possible that future code clean-up can benefit from its use. But without this patch,, the file does not compile for me (I compile everything with "-Werror -Wall").

If I recall correctly, http-push just doesn't work without curl-multi, so the correct fix would be to just disable http-push when USE_CURL_MULTI is undefined.

Mike

#2 lore raw
Quoted 3 lines · Mike Hommey

If I recall correctly, http-push just doesn't work without curl-multi, so the correct fix would be to just disable http-push when USE_CURL_MULTI is undefined.

Indeed, it dies on line 2253 (18d81a).

2252 #ifndef USE_CURL_MULTI
2253 die("git-push is not available for http/https repository
when not compiled with USE_CURL_MULTI");
2254 #endif

Signature · 2 lines
Cheers,
Ray Chuan