Skip to content

Commit

Permalink
Avoid ambiguous error message if pack.idx header is wrong
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luiz Fernando N. Capitulino authored and Junio C Hamano committed Aug 15, 2007
1 parent b798671 commit eef427a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ static int check_packed_git_idx(const char *path, struct packed_git *p)
*/
if (idx_size != 4*256 + nr * 24 + 20 + 20) {
munmap(idx_map, idx_size);
return error("wrong index file size in %s", path);
return error("wrong index v1 file size in %s", path);
}
} else if (version == 2) {
/*
Expand All @@ -519,7 +519,7 @@ static int check_packed_git_idx(const char *path, struct packed_git *p)
max_size += (nr - 1)*8;
if (idx_size < min_size || idx_size > max_size) {
munmap(idx_map, idx_size);
return error("wrong index file size in %s", path);
return error("wrong index v2 file size in %s", path);
}
if (idx_size != min_size) {
/* make sure we can deal with large pack offsets */
Expand Down

0 comments on commit eef427a

Please sign in to comment.