From 3c5e8468a93cdb427b4c4a129339e80e1813e5c0 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 26 Nov 2005 09:38:20 -0800 Subject: ls-tree: major rewrite to do pathspec git-ls-tree should be rewritten to use a pathspec the same way everybody else does. Right now it's the odd man out: if you do git-ls-tree HEAD divers/char drivers/ it will show the same files _twice_, which is not how pathspecs in general work. How about this patch? It breaks some of the git-ls-tree tests, but it makes git-ls-tree work a lot more like other git pathspec commands, and it removes more than 150 lines by re-using the recursive tree traversal (but the "-d" flag is gone for good, so I'm not pushing this too hard). Linus --- tree.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tree.h') diff --git a/tree.h b/tree.h index 9975e88216..768e5e9eb8 100644 --- a/tree.h +++ b/tree.h @@ -35,4 +35,13 @@ int parse_tree(struct tree *tree); /* Parses and returns the tree in the given ent, chasing tags and commits. */ struct tree *parse_tree_indirect(const unsigned char *sha1); +#define READ_TREE_RECURSIVE 1 +typedef int (*read_tree_fn_t)(unsigned char *, const char *, int, const char *, unsigned int, int); + +extern int read_tree_recursive(void *buffer, unsigned long size, + const char *base, int baselen, + int stage, const char **match, + read_tree_fn_t fn); + + #endif /* TREE_H */ -- cgit v1.2.1