X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-ls-tree.c;h=fca46312f681caf077565fb4bd5b59a70008eb59;hb=aff4e8dc217bdde9276e634ea7bf92adf926e573;hp=f4a75ddbc3fecb9c1690a94d39ce230e82fefd8d;hpb=438d2991eaa17549df67929cd4558d65840c37d7;p=git.git diff --git a/builtin-ls-tree.c b/builtin-ls-tree.c index f4a75ddbc..fca46312f 100644 --- a/builtin-ls-tree.c +++ b/builtin-ls-tree.c @@ -23,7 +23,7 @@ static int chomp_prefix; static const char *ls_tree_prefix; static const char ls_tree_usage[] = - "git-ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--abbrev[=]] [path...]"; + "git ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=]] [path...]"; static int show_recursive(const char *base, int baselen, const char *pathname) { @@ -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; @@ -66,17 +66,11 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen, /* * Maybe we want to have some recursive version here? * - * Something like: + * Something similar to this incomplete example: * - if (show_subprojects(base, baselen, pathname)) { - if (fork()) { - chdir(base); - exec ls-tree; - } - waitpid(); - } + if (show_subprojects(base, baselen, pathname)) + retval = READ_TREE_RECURSIVE; * - * ..or similar.. */ type = commit_type; } else if (S_ISDIR(mode)) { @@ -157,6 +151,11 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix) chomp_prefix = 0; break; } + if (!strcmp(argv[1]+2, "full-tree")) { + ls_tree_prefix = prefix = NULL; + chomp_prefix = 0; + break; + } if (!prefixcmp(argv[1]+2, "abbrev=")) { abbrev = strtoul(argv[1]+9, NULL, 10); if (abbrev && abbrev < MINIMUM_ABBREV) @@ -189,7 +188,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; }