{"thread":{"id":"2416","subject":"HTTP redirection with git-clone/git-fetch ?","startedAt":"2005-11-09T22:31:36Z","lastAt":"2005-11-11T17:38:00Z","messageCount":4,"participants":["Josef Weidendorfer","Nick Hengeveld","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"11416","messageId":"200511092331.36421.Josef.Weidendorfer@gmx.de","threadId":"2416","inReplyTo":null,"subject":"HTTP redirection with git-clone/git-fetch ?","fromName":"Josef Weidendorfer","fromEmail":"josef.weidendorfer@gmx.de","sentAt":"2005-11-09T22:31:36Z","receivedAt":"2005-11-09T22:31:36Z","isPatch":false,"sender":{"key":"josef.weidendorfer@gmx.de","avatar":null},"body":"Hi,\n\ngit-clone fails silently with a HTTP URL where the server\nresponds with a redirection (ie. header line \"Location:...\").\nI tried to add \"-L\" to the curl command line in git-clone.sh,\nbut this is only half of a fix. Afterwards I get:\n\ndefaulting to local storage area\nerror: Couldn't get http://repo/project.git/refs/heads/origin for heads/origin\nFailed writing body\nerror: Could not interpret heads/origin as something to pull\n\nThis seems because git-fetch should understand redirections, too.\nI am not familiar to the curl API. So perhaps another one can try to\nfix this?\n\nJosef\n"},{"id":"11444","messageId":"20051110002419.GB4051@reactrix.com","threadId":"2416","inReplyTo":"200511092331.36421.Josef.Weidendorfer@gmx.de","subject":"Re: HTTP redirection with git-clone/git-fetch ?","fromName":"Nick Hengeveld","fromEmail":"nickh@reactrix.com","sentAt":"2005-11-10T00:24:20Z","receivedAt":"2005-11-10T00:24:20Z","isPatch":false,"sender":{"key":"nickh@reactrix.com","avatar":null},"body":"On Wed, Nov 09, 2005 at 11:31:36PM +0100, Josef Weidendorfer wrote:\n\n> This seems because git-fetch should understand redirections, too.\n> I am not familiar to the curl API. So perhaps another one can try to\n> fix this?\n\nThis should fix it, although it still tries every GET with the original\nURL which is a bit inefficient.\n\n\nConfigure HTTP fetch to follow redirects\n\nSigned-off-by: Nick Hengeveld <nickh@reactrix.com>\n\n\n---\n\n git-fetch.sh |    2 +-\n http-fetch.c |    2 ++\n 2 files changed, 3 insertions(+), 1 deletions(-)\n\napplies-to: bc694e972ad9e82f65359788db6ef788078a975f\ndeb8d58781a60d4611651478c5b08739edf981b7\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 31e5f4c..8564cbf 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -230,7 +230,7 @@ do\n \t    $u =~ s{([^-a-zA-Z0-9/.])}{sprintf\"%%%02x\",ord($1)}eg;\n \t    print \"$u\";\n \t' \"$remote_name\")\n-\thead=$(curl -nsf $curl_extra_args \"$remote/$remote_name_quoted\") &&\n+\thead=$(curl -nsfL $curl_extra_args \"$remote/$remote_name_quoted\") &&\n \texpr \"$head\" : \"$_x40\\$\" >/dev/null ||\n \t\tdie \"Failed to fetch $remote_name from $remote\"\n \techo >&2 Fetching \"$remote_name from $remote\" using http\ndiff --git a/http-fetch.c b/http-fetch.c\nindex ea8af1b..28d225c 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -269,6 +269,8 @@ static CURL* get_curl_handle(void)\n \t\t\t\t curl_low_speed_time);\n \t}\n \n+\tcurl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);\n+\n \treturn result;\n }\n \n---\n0.99.9.GIT\n"},{"id":"11473","messageId":"200511101409.48618.Josef.Weidendorfer@gmx.de","threadId":"2416","inReplyTo":"20051110002419.GB4051@reactrix.com","subject":"Re: HTTP redirection with git-clone/git-fetch ?","fromName":"Josef Weidendorfer","fromEmail":"josef.weidendorfer@gmx.de","sentAt":"2005-11-10T13:09:48Z","receivedAt":"2005-11-10T13:09:48Z","isPatch":false,"sender":{"key":"josef.weidendorfer@gmx.de","avatar":null},"body":"On Thursday 10 November 2005 01:24, Nick Hengeveld wrote:\n> On Wed, Nov 09, 2005 at 11:31:36PM +0100, Josef Weidendorfer wrote:\n> \n> > This seems because git-fetch should understand redirections, too.\n> > I am not familiar to the curl API. So perhaps another one can try to\n> > fix this?\n> \n> This should fix it, although it still tries every GET with the original\n> URL which is a bit inefficient.\n\nThanks, I just sent a patch for git-clone, including your patch, to\nJunio.\n\nJosef\n"},{"id":"11612","messageId":"7vu0ejnkzr.fsf@assigned-by-dhcp.cox.net","threadId":"2416","inReplyTo":"200511101409.48618.Josef.Weidendorfer@gmx.de","subject":"Re: HTTP redirection with git-clone/git-fetch ?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-11T17:38:00Z","receivedAt":"2005-11-11T17:38:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Josef Weidendorfer <Josef.Weidendorfer@gmx.de> writes:\n\n>> This should fix it, although it still tries every GET with the original\n>> URL which is a bit inefficient.\n>\n> Thanks, I just sent a patch for git-clone, including your patch, to\n> Junio.\n\nThank you both.\n"}]}