summaryrefslogtreecommitdiff
path: root/pack-revindex.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2008-06-24 01:22:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-06-24 04:25:20 (GMT)
commit1f5c74f6cf918d317c73b328dcd4cf6f55c44d8a (patch)
tree7baaadebece43244c5602da3e9a716e99c94fcdc /pack-revindex.c
parent6b516d984bc72b359a14eeddfddca578cef52297 (diff)
downloadgit-1f5c74f6cf918d317c73b328dcd4cf6f55c44d8a.zip
git-1f5c74f6cf918d317c73b328dcd4cf6f55c44d8a.tar.gz
git-1f5c74f6cf918d317c73b328dcd4cf6f55c44d8a.tar.bz2
call init_pack_revindex() lazily
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>
Diffstat (limited to 'pack-revindex.c')
-rw-r--r--pack-revindex.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pack-revindex.c b/pack-revindex.c
index a8aa2cd..cd300bd 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -40,7 +40,7 @@ static int pack_revindex_ix(struct packed_git *p)
return -1 - i;
}
-void init_pack_revindex(void)
+static void init_pack_revindex(void)
{
int num;
struct packed_git *p;
@@ -118,9 +118,11 @@ struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs)
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)