{"thread":{"id":"26408","subject":"[BUG?] remote-http: interrupted fetch leaves bad index behind","startedAt":"2011-02-04T01:09:57Z","lastAt":"2011-02-04T01:09:57Z","messageCount":1,"participants":["Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"160369","messageId":"20110204010957.GB17483@elie","threadId":"26408","inReplyTo":"20101105170640.30975.94952.reportbug@deb0","subject":"[BUG?] remote-http: interrupted fetch leaves bad index behind","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-02-04T01:09:57Z","receivedAt":"2011-02-04T01:09:57Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi gitsters,\n\nTörök Edwin wrote[1]:\n\n> If I run 'git remote update' when the remote is an http URL, and then\n> I Ctrl-C in the middle of a pack download, I get the .idx and .pack.temp.\n> \n> Next time when I run 'git remote update' it tells me it can't find some refs:\n> error: Unable to find 72128861501dc742d33e88b473482e17f6672d4c under http://git.clamav.net/clamav-devel.git\n> Cannot obtain needed object 72128861501dc742d33e88b473482e17f6672d4c\n> error: Fetch failed.\n\nSteps to reproduce:\n\n 1. Disable smart HTTP[2].\n 2.\n\tgit init reproduce\n\tcd reproduce\n\tgit remote add clam http://git.clamav.net/clamav-devel.git\n 3. git fetch clam\n    Wait a few seconds (there will be no output).  Hit ^C.\n\n$ ls .git/objects/pack/\npack-98c82c9d2da21d2efddc4544d68332235795df19.idx.temp.temp\n$ git fetch clam\nerror: wrong index v2 file size in .git/objects/pack/pack-98c82c9d2da21d2efddc4544d68332235795df19.idx.temp\nerror: Unable to find fe96c524670f23f73008c0e6b4001c096e4f9532 under http://git.clamav.net/clamav-devel.git\nCannot obtain needed object fe96c524670f23f73008c0e6b4001c096e4f9532\nerror: Fetch failed.\n\nIdeas?\nJonathan\n\n[1] http://bugs.debian.org/602528\n[2]\ndiff --git a/remote-curl.c b/remote-curl.c\nindex 04d4813..b0ad1aa 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -625,10 +625,12 @@ static int fetch_git(struct discovery *heads,\n \n static int fetch(int nr_heads, struct ref **to_fetch)\n {\n+#if 0\n \tstruct discovery *d = discover_refs(\"git-upload-pack\");\n \tif (d->proto_git)\n \t\treturn fetch_git(d, nr_heads, to_fetch);\n \telse\n+#endif\n \t\treturn fetch_dumb(nr_heads, to_fetch);\n }\n \n"}]}