verify-pack updates.
PATCH 1/2 verify-pack updates.
Nico pointed out that having verify_pack.c and verify-pack.c was confusing. Rename verify_pack.c to pack-check.c as suggested, and enhances the verification done quite a bit.
- Built-in sha1_file unpacking knows that a base object of a deltified object _must_ be in the same pack, and takes advantage of that fact.
- Earlier verify-pack command only checked the SHA1 sum for the entire pack file and did not look into its contents. It now checks everything idx file claims to have unpacks correctly.
- It now has a hook to give more detailed information for objects contained in the pack under -v flag.
---
*** I used "git format-patch -M20" to generate diff to show this *** commit as a rename/copy patch. Let's see if git-apply can *** still grok it ;-).
Makefile | 2 +- cache.h | 9 ++++++++ fsck-cache.c | 2 +- pack-check.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++-------- pack.h | 2 +- sha1_file.c | 66 +++++++++++++++++++++++++++++++++++++------------------ verify-pack.c | 51 ++++++++++++++++++++++++++++++++++--------- 7 files changed, 156 insertions(+), 44 deletions(-) rename verify_pack.c => pack-check.c (25%)
cf43fb6e9fec205d4786a284e1656b3612c28a77
Makefile +1 -1
@@ -46,7 +46,7 @@ install: $(PROG) $(SCRIPTS) LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \ tag.o date.o index.o diff-delta.o patch-delta.o entry.o \ - epoch.o refs.o csum-file.o verify_pack.o pkt-line.o + epoch.o refs.o csum-file.o pack-check.o pkt-line.o LIB_FILE=libgit.a LIB_H=cache.h object.h blob.h tree.h commit.h tag.h delta.h epoch.h csum-file.h \ pack.h pkt-line.h
cache.h +9 -0
@@ -251,11 +251,20 @@ extern struct packed_git {unsigned int pack_use_cnt;char pack_name[0 ];/* something like ".git/objects/pack/xxxxx.pack" */ } *packed_git; + +struct pack_entry { +unsigned int offset; +unsigned char sha1[20 ]; +struct packed_git *p; +}; +extern void prepare_packed_git (void );extern int use_packed_git (struct packed_git *);extern void unuse_packed_git (struct packed_git *);extern struct packed_git *add_packed_git (char *,int );extern int num_packed_objects (const struct packed_git *p);extern int nth_packed_object_sha1 (const struct packed_git *,int ,unsigned char *); +extern int find_pack_entry_one (const unsigned char *,struct pack_entry *,struct packed_git *); +extern void *unpack_entry_gently (struct pack_entry *,char *,unsigned long *);#endif /* CACHE_H */
fsck-cache.c +1 -1
@@ -440,7 +440,7 @@ int main(int argc, char **argv)prepare_packed_git ();for (p = packed_git; p; p = p->next)/* verify gives error messages itself */ -verify_pack (p); +verify_pack (p,0 );for (p = packed_git; p; p = p->next) {int num =num_packed_objects (p);
pack-check.c renamed from verify_pack.c +59 -9
95 lines not on this page · raw message
pack.h +1 -1
@@ -27,6 +27,6 @@ struct pack_header { unsigned int hdr_entries; }; -extern int verify_pack (struct packed_git *); +extern int verify_pack (struct packed_git *,int );#endif
sha1_file.c +44 -22
148 lines not on this page · raw message
verify-pack.c +41 -10
66 lines not on this page · raw message
------------