http: inform about alternates-as-redirects behavior
authorEric Wong <e@80x24.org>
Sat, 4 Mar 2017 08:36:45 +0000 (08:36 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Mar 2017 18:52:15 +0000 (10:52 -0800)
It is disconcerting for users to not notice the behavior
change in handling alternates from commit cb4d2d35c4622ec2
("http: treat http-alternates like redirects")

Give the user a hint about the config option so they can
see the URL and decide whether or not they want to enable
http.followRedirects in their config.

Signed-off-by: Eric Wong <e@80x24.org>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-walker.c
index b34b6ace7cd80a482eae16e2063aa9d8960e8729..6396cebe5eefc79a2737c7338f2a8a6cfc6f4427 100644 (file)
@@ -168,6 +168,11 @@ static int is_alternate_allowed(const char *url)
        };
        int i;
 
+       if (http_follow_config != HTTP_FOLLOW_ALWAYS) {
+               warning("alternate disabled by http.followRedirects: %s", url);
+               return 0;
+       }
+
        for (i = 0; i < ARRAY_SIZE(protocols); i++) {
                const char *end;
                if (skip_prefix(url, protocols[i], &end) &&
@@ -331,9 +336,6 @@ static void fetch_alternates(struct walker *walker, const char *base)
        struct alternates_request alt_req;
        struct walker_data *cdata = walker->data;
 
-       if (http_follow_config != HTTP_FOLLOW_ALWAYS)
-               return;
-
        /*
         * If another request has already started fetching alternates,
         * wait for them to arrive and return to processing this request's