Re: HTTP redirection with git-clone/git-fetch ?
On Wed, Nov 09, 2005 at 11:31:36PM +0100, Josef Weidendorfer wrote:
> This seems because git-fetch should understand redirections, too.
> I am not familiar to the curl API. So perhaps another one can try to
> fix this?
This should fix it, although it still tries every GET with the original URL which is a bit inefficient.
Configure HTTP fetch to follow redirects
Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
---
git-fetch.sh | 2 +-
http-fetch.c | 2 ++
2 files changed, 3 insertions(+), 1 deletions(-)
applies-to: bc694e972ad9e82f65359788db6ef788078a975f deb8d58781a60d4611651478c5b08739edf981b7
diff --git a/git-fetch.sh b/git-fetch.sh
index 31e5f4c..8564cbf 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -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
diff --git a/http-fetch.c b/http-fetch.c
index ea8af1b..28d225c 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -269,6 +269,8 @@ static CURL* get_curl_handle(void)
curl_low_speed_time);
}
+ curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);
+
return result;
}
---
0.99.9.GIT