summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6b516d9)
raw | patch | inline | side by side (parent: 6b516d9)
author | Nicolas Pitre <nico@cam.org> | |
Tue, 24 Jun 2008 01:22:14 +0000 (21:22 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 24 Jun 2008 04:25:20 +0000 (21:25 -0700) |
This makes life much easier for next patch, as well as being more efficient
when the revindex is actually not used.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
when the revindex is actually not used.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c | patch | blob | history | |
pack-check.c | patch | blob | history | |
pack-revindex.c | patch | blob | history | |
pack-revindex.h | patch | blob | history |
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 447d492dbbfb578b8903293fa1d2a988eecfefac..827673ce4e81e14e13ae4b41ac89c18f6201ddb6 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
sorted_by_offset[i] = objects + i;
qsort(sorted_by_offset, nr_objects, sizeof(*sorted_by_offset), pack_offset_sort);
- init_pack_revindex();
-
for (i = 0; i < nr_objects; i++)
check_object(sorted_by_offset[i]);
diff --git a/pack-check.c b/pack-check.c
index f4898732dd8cd8ad2d8599cb13e0d9d96dda753b..b99a9171c023ece7db0a387a49bdb75287bcc06f 100644 (file)
--- a/pack-check.c
+++ b/pack-check.c
nr_objects = p->num_objects;
memset(chain_histogram, 0, sizeof(chain_histogram));
- init_pack_revindex();
for (i = 0; i < nr_objects; i++) {
const unsigned char *sha1;
diff --git a/pack-revindex.c b/pack-revindex.c
index a8aa2cd6caefe7d37febdf5c3426cec043492b19..cd300bdff5b524a4d509ba5276e9ef21f443013d 100644 (file)
--- a/pack-revindex.c
+++ b/pack-revindex.c
return -1 - i;
}
-void init_pack_revindex(void)
+static void init_pack_revindex(void)
{
int num;
struct packed_git *p;
struct pack_revindex *rix;
struct revindex_entry *revindex;
+ if (!pack_revindex_hashsz)
+ init_pack_revindex();
num = pack_revindex_ix(p);
if (num < 0)
- die("internal error: pack revindex uninitialized");
+ die("internal error: pack revindex fubar");
rix = &pack_revindex[num];
if (!rix->revindex)
diff --git a/pack-revindex.h b/pack-revindex.h
index c3527a75655470b95ab4ba0900e9c1ad6a15a35f..36a514a6cf600e7e77794e50998a9d160e30c8e9 100644 (file)
--- a/pack-revindex.h
+++ b/pack-revindex.h
unsigned int nr;
};
-void init_pack_revindex(void);
struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs);
#endif