packfile: use oidset for bad objects
Store the object ID of broken pack entries in an oidset instead of keeping only their hashes in an unsorted array. The resulting code is shorter and easier to read. It also handles the (hopefully) very rare case of having a high number of bad objects better. Helped-by: Jeff King <peff@peff.net> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
7407d733a4
commit
09ef66179b
@ -10,6 +10,7 @@
|
||||
#include "khash.h"
|
||||
#include "dir.h"
|
||||
#include "oidtree.h"
|
||||
#include "oidset.h"
|
||||
|
||||
struct object_directory {
|
||||
struct object_directory *next;
|
||||
@ -75,9 +76,8 @@ struct packed_git {
|
||||
const void *index_data;
|
||||
size_t index_size;
|
||||
uint32_t num_objects;
|
||||
uint32_t num_bad_objects;
|
||||
uint32_t crc_offset;
|
||||
unsigned char *bad_object_sha1;
|
||||
struct oidset bad_objects;
|
||||
int index_version;
|
||||
time_t mtime;
|
||||
int pack_fd;
|
||||
|
Reference in New Issue
Block a user