index: make the index file format extensible.

... and move the cache-tree data into it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano
2006-04-24 21:18:58 -07:00
parent dd0c34c46b
commit bad68ec924
10 changed files with 146 additions and 149 deletions

View File

@ -2,12 +2,11 @@
#include "tree.h"
#include "cache-tree.h"
static unsigned char active_cache_sha1[20];
static struct cache_tree *active_cache_tree;
static void dump_cache_tree(struct cache_tree *it, const char *pfx)
{
int i;
if (!it)
return;
if (it->entry_count < 0)
printf("%-40s %s\n", "invalid", pfx);
else
@ -24,9 +23,8 @@ static void dump_cache_tree(struct cache_tree *it, const char *pfx)
int main(int ac, char **av)
{
if (read_cache_1(active_cache_sha1) < 0)
if (read_cache() < 0)
die("unable to read index file");
active_cache_tree = read_cache_tree(active_cache_sha1);
dump_cache_tree(active_cache_tree, "");
return 0;
}