add context pointer to read_tree_recursive()

Add a pointer parameter to read_tree_recursive(), which is passed to the
callback function.  This allows callers of read_tree_recursive() to
share data with the callback without resorting to global variables.  All
current callers pass NULL.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2008-07-14 21:22:12 +02:00
committed by Junio C Hamano
parent 34533004b2
commit 671f070721
8 changed files with 28 additions and 26 deletions

View File

@ -56,7 +56,7 @@ static int show_recursive(const char *base, int baselen, const char *pathname)
}
static int show_tree(const unsigned char *sha1, const char *base, int baselen,
const char *pathname, unsigned mode, int stage)
const char *pathname, unsigned mode, int stage, void *context)
{
int retval = 0;
const char *type = blob_type;
@ -189,7 +189,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
tree = parse_tree_indirect(sha1);
if (!tree)
die("not a tree object");
read_tree_recursive(tree, "", 0, 0, pathspec, show_tree);
read_tree_recursive(tree, "", 0, 0, pathspec, show_tree, NULL);
return 0;
}