Skip to content

Commit

Permalink
Let git-clone/git-fetch follow HTTP redirections
Browse files Browse the repository at this point in the history
Otherwise, git-clone silently failed to clone a remote
repository where redirections (ie. a response with a
"Location" header line) are used.

This includes the fixes from Nick Hengeveld.

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Josef Weidendorfer authored and Junio C Hamano committed Nov 10, 2005
1 parent ad7db62 commit 66c9ec2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion git-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi

http_fetch () {
# $1 = Remote, $2 = Local
curl -nsf $curl_extra_args "$1" >"$2"
curl -nsfL $curl_extra_args "$1" >"$2"
}

clone_dumb_http () {
Expand Down
2 changes: 1 addition & 1 deletion git-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ do
$u =~ s{([^-a-zA-Z0-9/.])}{sprintf"%%%02x",ord($1)}eg;
print "$u";
' "$remote_name")
head=$(curl -nsf $curl_extra_args "$remote/$remote_name_quoted") &&
head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted") &&
expr "$head" : "$_x40\$" >/dev/null ||
die "Failed to fetch $remote_name from $remote"
echo >&2 Fetching "$remote_name from $remote" using http
Expand Down
2 changes: 2 additions & 0 deletions http-fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ static CURL* get_curl_handle(void)
curl_low_speed_time);
}

curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);

return result;
}

Expand Down

0 comments on commit 66c9ec2

Please sign in to comment.