path: root/diff-index.c
diff options
authorDaniel Barkalow <>2006-01-26 06:13:36 (GMT)
committerJunio C Hamano <>2006-01-26 09:08:29 (GMT)
commit521698b1538fb3c9bd818ee98f2c17d2c80c9605 (patch)
tree0162088be261b4880ac40bda405f81cb9cebbdd9 /diff-index.c
parent731043fd4d55b1561ebb5a53daa4b9ff6dfac046 (diff)
Only use a single parser for tree objects
This makes read_tree_recursive and read_tree take a struct tree instead of a buffer. It also move the declaration of read_tree into tree.h (where struct tree is defined), and updates ls-tree and diff-index (the only places that presently use read_tree*()) to use the new versions. Signed-off-by: Daniel Barkalow <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'diff-index.c')
1 files changed, 4 insertions, 4 deletions
diff --git a/diff-index.c b/diff-index.c
index 87e1061..bbd873b 100644
--- a/diff-index.c
+++ b/diff-index.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "tree.h"
#include "diff.h"
static int cached_only = 0;
@@ -174,8 +175,7 @@ int main(int argc, const char **argv)
unsigned char sha1[20];
const char *prefix = setup_git_directory();
const char **pathspec = NULL;
- void *tree;
- unsigned long size;
+ struct tree *tree;
int ret;
int allow_options = 1;
int i;
@@ -233,10 +233,10 @@ int main(int argc, const char **argv)
- tree = read_object_with_reference(sha1, "tree", &size, NULL);
+ tree = parse_tree_indirect(sha1);
if (!tree)
die("bad tree object %s", tree_name);
- if (read_tree(tree, size, 1, pathspec))
+ if (read_tree(tree, 1, pathspec))
die("unable to read tree object %s", tree_name);
ret = diff_cache(active_cache, active_nr, pathspec);