git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Hengeveld <nickh@reactrix.com>
To: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: HTTP redirection with git-clone/git-fetch ?
Date: Wed, 9 Nov 2005 16:24:20 -0800	[thread overview]
Message-ID: <20051110002419.GB4051@reactrix.com> (raw)
In-Reply-To: <200511092331.36421.Josef.Weidendorfer@gmx.de>

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

  reply	other threads:[~2005-11-10  0:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-09 22:31 HTTP redirection with git-clone/git-fetch ? Josef Weidendorfer
2005-11-10  0:24 ` Nick Hengeveld [this message]
2005-11-10 13:09   ` Josef Weidendorfer
2005-11-11 17:38     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051110002419.GB4051@reactrix.com \
    --to=nickh@reactrix.com \
    --cc=Josef.Weidendorfer@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).