@matheusbsbs / matheus-bagliano / commits / eef427a09c
Fork 0

Avoid ambiguous error message if pack.idx header is wrong

Print the index version when an error occurs so the user knows what type of header (and size) we thought the index should have had. Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Luiz Fernando N. Capitulino committed Aug 14, 2007 at 16:42 UTC eef427a09ce7fcbdc54c73ae363cbab331eccd88
1 file changed +2 -2
sha1_file.c
+2 -2
@@ -497,7 +497,7 @@ static int check_packed_git_idx(const char *path, struct packed_git *p)
497 */
498 if (idx_size != 4*256 + nr * 24 + 20 + 20) {
499 munmap(idx_map, idx_size);
500 - return error("wrong index file size in %s", path);
500 + return error("wrong index v1 file size in %s", path);
501 }
502 } else if (version == 2) {
503 /*
@@ -519,7 +519,7 @@ static int check_packed_git_idx(const char *path, struct packed_git *p)
519 max_size += (nr - 1)*8;
520 if (idx_size < min_size || idx_size > max_size) {
521 munmap(idx_map, idx_size);
522 - return error("wrong index file size in %s", path);
522 + return error("wrong index v2 file size in %s", path);
523 }
524 if (idx_size != min_size) {
525 /* make sure we can deal with large pack offsets */