Skip to content

Commit de46138

Browse files
Eric Wonggitster
authored andcommitted
http: inform about alternates-as-redirects behavior
It is disconcerting for users to not notice the behavior change in handling alternates from commit cb4d2d3 ("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 <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e7e07d5 commit de46138

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

http-walker.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ static int is_alternate_allowed(const char *url)
168168
};
169169
int i;
170170

171+
if (http_follow_config != HTTP_FOLLOW_ALWAYS) {
172+
warning("alternate disabled by http.followRedirects: %s", url);
173+
return 0;
174+
}
175+
171176
for (i = 0; i < ARRAY_SIZE(protocols); i++) {
172177
const char *end;
173178
if (skip_prefix(url, protocols[i], &end) &&
@@ -331,9 +336,6 @@ static void fetch_alternates(struct walker *walker, const char *base)
331336
struct alternates_request alt_req;
332337
struct walker_data *cdata = walker->data;
333338

334-
if (http_follow_config != HTTP_FOLLOW_ALWAYS)
335-
return;
336-
337339
/*
338340
* If another request has already started fetching alternates,
339341
* wait for them to arrive and return to processing this request's

0 commit comments

Comments
 (0)