Revert "check_packed_git_idx(): check integrity of the idx file itself."
This reverts c5ced64578a82b9d172aceb2f67c6fb9e639f6d9 commit. It turns out that doing this check every time we map the idx file is quite expensive. A corrupt idx file is caught by git-fsck-objects, so this check is not strictly necessary. In one unscientific test, 0.99.9m spent 10 seconds usertime for the same task 1.1.3 takes 37 seconds usertime. Reverting this gives us the performance of 0.99.9 back.
Junio C Hamano committed
Jan 18, 2006 at 20:26 UTC
e93ec6f9d8dd122557d54505129f7860b9301503
1 file changed
+1
-15
sha1_file.c
+1
-15
@@ -321,16 +321,12 @@ struct packed_git *packed_git;
321
static int check_packed_git_idx(const char *path, unsigned long *idx_size_,
322
void **idx_map_)
323
{
324
- SHA_CTX ctx;
325
- unsigned char sha1[20];
324
void *idx_map;
325
unsigned int *index;
326
unsigned long idx_size;
327
int nr, i;
330
- int fd;
328
+ int fd = open(path, O_RDONLY);
329
struct stat st;
332
-
333
- fd = open(path, O_RDONLY);
330
if (fd < 0)
331
return -1;
332
if (fstat(fd, &st)) {
@@ -368,16 +364,6 @@ static int check_packed_git_idx(const char *path, unsigned long *idx_size_,
364
if (idx_size != 4*256 + nr * 24 + 20 + 20)
365
return error("wrong index file size");
366
371
- /*
372
- * File checksum.
373
- */
374
- SHA1_Init(&ctx);
375
- SHA1_Update(&ctx, idx_map, idx_size-20);
376
- SHA1_Final(sha1, &ctx);
377
-
378
- if (memcmp(sha1, idx_map + idx_size - 20, 20))
379
- return error("index checksum mismatch");
380
-
367
return 0;
368
}
369