Skip to contentSkip to conversation

remote-http: interrupted fetch leaves bad index behind

BUG? Jonathan Nieder 1 participant 1 message Jun 15, 2016 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi gitsters,

Török Edwin wrote[1]:

Quoted 7 lines

If I run 'git remote update' when the remote is an http URL, and then I Ctrl-C in the middle of a pack download, I get the .idx and .pack.temp.

Next time when I run 'git remote update' it tells me it can't find some refs:
error: Unable to find 72128861501dc742d33e88b473482e17f6672d4c under http://git.clamav.net/clamav-devel.git
Cannot obtain needed object 72128861501dc742d33e88b473482e17f6672d4c
error: Fetch failed.

Steps to reproduce:

1. Disable smart HTTP[2].
2.
git init reproduce
cd reproduce
git remote add clam http://git.clamav.net/clamav-devel.git
3. git fetch clam
Wait a few seconds (there will be no output). Hit ^C.

$ ls .git/objects/pack/
pack-98c82c9d2da21d2efddc4544d68332235795df19.idx.temp.temp
$ git fetch clam
error: wrong index v2 file size in .git/objects/pack/pack-98c82c9d2da21d2efddc4544d68332235795df19.idx.temp
error: Unable to find fe96c524670f23f73008c0e6b4001c096e4f9532 under http://git.clamav.net/clamav-devel.git
Cannot obtain needed object fe96c524670f23f73008c0e6b4001c096e4f9532
error: Fetch failed.

Ideas?
Jonathan

[1] http://bugs.debian.org/602528
[2]

remote-curl.c +2 -0
index 04d4813..b0ad1aa 100644
@@ -625,10 +625,12 @@ static int fetch_git(struct discovery *heads,
 
 static int fetch(int nr_heads, struct ref **to_fetch)
 {
+#if 0
 	struct discovery *d = discover_refs("git-upload-pack");
 	if (d->proto_git)
 		return fetch_git(d, nr_heads, to_fetch);
 	else
+#endif
 		return fetch_dumb(nr_heads, to_fetch);
 }