2005-04-13 13:02:34 +04:00
|
|
|
/*
|
|
|
|
* GIT - The information manager from hell
|
|
|
|
*
|
|
|
|
* Copyright (C) Linus Torvalds, 2005
|
|
|
|
*/
|
|
|
|
#include "cache.h"
|
2017-06-14 21:07:36 +03:00
|
|
|
#include "config.h"
|
2018-05-16 02:42:15 +03:00
|
|
|
#include "object-store.h"
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 11:05:38 +04:00
|
|
|
#include "blob.h"
|
|
|
|
#include "tree.h"
|
2007-04-10 08:20:29 +04:00
|
|
|
#include "commit.h"
|
2005-10-15 08:56:46 +04:00
|
|
|
#include "quote.h"
|
2006-05-23 16:15:30 +04:00
|
|
|
#include "builtin.h"
|
2009-11-14 07:34:08 +03:00
|
|
|
#include "parse-options.h"
|
2013-07-14 12:35:25 +04:00
|
|
|
#include "pathspec.h"
|
2005-04-13 13:02:34 +04:00
|
|
|
|
2005-05-20 22:46:10 +04:00
|
|
|
static int line_termination = '\n';
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 11:05:38 +04:00
|
|
|
#define LS_RECURSIVE 1
|
|
|
|
#define LS_TREE_ONLY 2
|
2005-12-01 21:35:51 +03:00
|
|
|
#define LS_SHOW_TREES 4
|
2005-12-02 01:54:00 +03:00
|
|
|
#define LS_NAME_ONLY 8
|
2007-05-20 00:08:11 +04:00
|
|
|
#define LS_SHOW_SIZE 16
|
2006-08-15 21:23:48 +04:00
|
|
|
static int abbrev;
|
|
|
|
static int ls_options;
|
2011-03-25 12:34:19 +03:00
|
|
|
static struct pathspec pathspec;
|
2006-08-15 21:23:48 +04:00
|
|
|
static int chomp_prefix;
|
2006-07-29 09:44:25 +04:00
|
|
|
static const char *ls_tree_prefix;
|
2005-04-15 19:37:05 +04:00
|
|
|
|
2009-11-14 07:34:08 +03:00
|
|
|
static const char * const ls_tree_usage[] = {
|
2012-08-20 16:32:21 +04:00
|
|
|
N_("git ls-tree [<options>] <tree-ish> [<path>...]"),
|
2009-11-14 07:34:08 +03:00
|
|
|
NULL
|
|
|
|
};
|
2005-12-01 21:35:51 +03:00
|
|
|
|
2022-03-23 12:13:05 +03:00
|
|
|
static int show_recursive(const char *base, size_t baselen, const char *pathname)
|
2005-12-01 21:35:51 +03:00
|
|
|
{
|
2017-01-04 21:03:59 +03:00
|
|
|
int i;
|
2005-12-01 21:35:51 +03:00
|
|
|
|
|
|
|
if (ls_options & LS_RECURSIVE)
|
|
|
|
return 1;
|
|
|
|
|
2017-01-04 21:03:59 +03:00
|
|
|
if (!pathspec.nr)
|
2005-12-01 21:35:51 +03:00
|
|
|
return 0;
|
|
|
|
|
2017-01-04 21:03:59 +03:00
|
|
|
for (i = 0; i < pathspec.nr; i++) {
|
|
|
|
const char *spec = pathspec.items[i].match;
|
2022-03-23 12:13:05 +03:00
|
|
|
size_t len, speclen;
|
2005-12-01 21:35:51 +03:00
|
|
|
|
|
|
|
if (strncmp(base, spec, baselen))
|
|
|
|
continue;
|
|
|
|
len = strlen(pathname);
|
|
|
|
spec += baselen;
|
|
|
|
speclen = strlen(spec);
|
|
|
|
if (speclen <= len)
|
|
|
|
continue;
|
2010-09-11 22:47:09 +04:00
|
|
|
if (spec[len] && spec[len] != '/')
|
|
|
|
continue;
|
2005-12-01 21:35:51 +03:00
|
|
|
if (memcmp(pathname, spec, len))
|
|
|
|
continue;
|
|
|
|
return 1;
|
|
|
|
}
|
2017-01-04 21:03:59 +03:00
|
|
|
return 0;
|
2005-12-01 21:35:51 +03:00
|
|
|
}
|
2005-04-15 19:37:05 +04:00
|
|
|
|
2018-03-12 05:27:26 +03:00
|
|
|
static int show_tree(const struct object_id *oid, struct strbuf *base,
|
2021-03-21 01:37:51 +03:00
|
|
|
const char *pathname, unsigned mode, void *context)
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 11:05:38 +04:00
|
|
|
{
|
2022-03-23 12:13:06 +03:00
|
|
|
int recurse = 0;
|
2022-03-23 12:13:05 +03:00
|
|
|
size_t baselen;
|
2022-03-23 12:13:07 +03:00
|
|
|
enum object_type type = object_type(mode);
|
2005-10-08 03:54:06 +04:00
|
|
|
|
2022-03-23 12:13:07 +03:00
|
|
|
if (type == OBJ_BLOB) {
|
|
|
|
if (ls_options & LS_TREE_ONLY)
|
|
|
|
return 0;
|
|
|
|
} else if (type == OBJ_TREE &&
|
|
|
|
show_recursive(base->buf, base->len, pathname)) {
|
|
|
|
recurse = READ_TREE_RECURSIVE;
|
|
|
|
if (!(ls_options & LS_SHOW_TREES))
|
|
|
|
return recurse;
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 11:05:38 +04:00
|
|
|
}
|
2005-10-08 03:54:06 +04:00
|
|
|
|
2007-05-20 00:08:11 +04:00
|
|
|
if (!(ls_options & LS_NAME_ONLY)) {
|
|
|
|
if (ls_options & LS_SHOW_SIZE) {
|
2009-03-20 01:54:29 +03:00
|
|
|
char size_text[24];
|
2022-03-23 12:13:04 +03:00
|
|
|
if (type == OBJ_BLOB) {
|
2009-03-20 01:54:29 +03:00
|
|
|
unsigned long size;
|
2018-04-25 21:20:59 +03:00
|
|
|
if (oid_object_info(the_repository, oid, &size) == OBJ_BAD)
|
2015-09-25 00:06:08 +03:00
|
|
|
xsnprintf(size_text, sizeof(size_text),
|
|
|
|
"BAD");
|
2009-03-20 01:54:29 +03:00
|
|
|
else
|
2015-09-25 00:06:08 +03:00
|
|
|
xsnprintf(size_text, sizeof(size_text),
|
2018-11-11 10:05:04 +03:00
|
|
|
"%"PRIuMAX, (uintmax_t)size);
|
2022-03-23 12:13:03 +03:00
|
|
|
} else {
|
2015-09-25 00:06:08 +03:00
|
|
|
xsnprintf(size_text, sizeof(size_text), "-");
|
2022-03-23 12:13:03 +03:00
|
|
|
}
|
2022-03-23 12:13:04 +03:00
|
|
|
printf("%06o %s %s %7s\t", mode, type_name(type),
|
2018-03-12 05:27:30 +03:00
|
|
|
find_unique_abbrev(oid, abbrev),
|
2009-03-20 01:54:29 +03:00
|
|
|
size_text);
|
2022-03-23 12:13:03 +03:00
|
|
|
} else {
|
2022-03-23 12:13:04 +03:00
|
|
|
printf("%06o %s %s\t", mode, type_name(type),
|
2018-03-12 05:27:30 +03:00
|
|
|
find_unique_abbrev(oid, abbrev));
|
2022-03-23 12:13:03 +03:00
|
|
|
}
|
2007-05-20 00:08:11 +04:00
|
|
|
}
|
2014-11-30 12:05:01 +03:00
|
|
|
baselen = base->len;
|
|
|
|
strbuf_addstr(base, pathname);
|
|
|
|
write_name_quoted_relative(base->buf,
|
|
|
|
chomp_prefix ? ls_tree_prefix : NULL,
|
|
|
|
stdout, line_termination);
|
|
|
|
strbuf_setlen(base, baselen);
|
2022-03-23 12:13:06 +03:00
|
|
|
return recurse;
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 11:05:38 +04:00
|
|
|
}
|
2005-04-17 00:57:39 +04:00
|
|
|
|
2006-07-29 09:44:25 +04:00
|
|
|
int cmd_ls_tree(int argc, const char **argv, const char *prefix)
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 11:05:38 +04:00
|
|
|
{
|
2017-05-07 01:10:34 +03:00
|
|
|
struct object_id oid;
|
2006-01-26 09:13:36 +03:00
|
|
|
struct tree *tree;
|
2011-03-25 12:34:19 +03:00
|
|
|
int i, full_tree = 0;
|
2009-11-14 07:34:08 +03:00
|
|
|
const struct option ls_tree_options[] = {
|
2012-08-20 16:32:21 +04:00
|
|
|
OPT_BIT('d', NULL, &ls_options, N_("only show trees"),
|
2009-11-14 07:34:08 +03:00
|
|
|
LS_TREE_ONLY),
|
2012-08-20 16:32:21 +04:00
|
|
|
OPT_BIT('r', NULL, &ls_options, N_("recurse into subtrees"),
|
2009-11-14 07:34:08 +03:00
|
|
|
LS_RECURSIVE),
|
2012-08-20 16:32:21 +04:00
|
|
|
OPT_BIT('t', NULL, &ls_options, N_("show trees when recursing"),
|
2009-11-14 07:34:08 +03:00
|
|
|
LS_SHOW_TREES),
|
|
|
|
OPT_SET_INT('z', NULL, &line_termination,
|
2012-08-20 16:32:21 +04:00
|
|
|
N_("terminate entries with NUL byte"), 0),
|
2022-03-23 12:13:08 +03:00
|
|
|
OPT_CMDMODE('l', "long", &ls_options, N_("include object size"),
|
|
|
|
LS_SHOW_SIZE),
|
|
|
|
OPT_CMDMODE(0, "name-only", &ls_options, N_("list only filenames"),
|
|
|
|
LS_NAME_ONLY),
|
|
|
|
OPT_CMDMODE(0, "name-status", &ls_options, N_("list only filenames"),
|
|
|
|
LS_NAME_ONLY),
|
2009-11-14 07:34:08 +03:00
|
|
|
OPT_SET_INT(0, "full-name", &chomp_prefix,
|
2012-08-20 16:32:21 +04:00
|
|
|
N_("use full path names"), 0),
|
2013-08-03 15:51:19 +04:00
|
|
|
OPT_BOOL(0, "full-tree", &full_tree,
|
|
|
|
N_("list entire tree; not just current directory "
|
|
|
|
"(implies --full-name)")),
|
2009-11-14 07:34:08 +03:00
|
|
|
OPT__ABBREV(&abbrev),
|
|
|
|
OPT_END()
|
|
|
|
};
|
2005-04-13 13:02:34 +04:00
|
|
|
|
2008-05-14 21:46:53 +04:00
|
|
|
git_config(git_default_config, NULL);
|
2006-07-29 09:44:25 +04:00
|
|
|
ls_tree_prefix = prefix;
|
ls-tree: chomp leading directories when run from a subdirectory
When run from a subdirectory, even though we filtered the output
based on where we were using pathspec, we wrote out the
repository relative paths, not subtree relative paths. This
changes things so that it shows only the current subdirectory
relative paths.
For example, in Documentation subdirectory of git itself, this
used to be the case:
$ git-ls-tree --name-only HEAD | grep how
Documentation/git-show-branch.txt
Documentation/git-show-index.txt
Documentation/howto-index.sh
Documentation/howto
But now it does this instead:
$ git-ls-tree --name-only HEAD | grep how
git-show-branch.txt
git-show-index.txt
howto-index.sh
howto
There are two things to keep in mind.
1. This shows nothing.
$ git-ls-tree --name-only HEAD ../ppc/
This is to make things consistent with ls-files, which
refuses relative path that goes uplevel.
2. These show things in full repository relative paths. In this
case, paths outside the current subdirectory are also shown.
$ git-ls-tree --name-only --full-name HEAD | grep how
Documentation/git-show-branch.txt
Documentation/git-show-index.txt
Documentation/howto-index.sh
Documentation/howto
$ git-ls-tree --name-only --full-name HEAD ../ppc/
ppc/sha1.c
ppc/sha1.h
ppc/sha1ppc.S
The flag --full-name gives the same behaviour as 1.0, so it
ought to be the default if we really care about the backward
compatibility, but in practice no Porcelain runs ls-tree from a
subdirectory yet, and without --full-name is more human
friendly, so hopefully the default being not --full-name would
be acceptable.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-24 00:39:30 +03:00
|
|
|
if (prefix && *prefix)
|
|
|
|
chomp_prefix = strlen(prefix);
|
2009-11-14 07:34:08 +03:00
|
|
|
|
|
|
|
argc = parse_options(argc, argv, prefix, ls_tree_options,
|
|
|
|
ls_tree_usage, 0);
|
|
|
|
if (full_tree) {
|
|
|
|
ls_tree_prefix = prefix = NULL;
|
|
|
|
chomp_prefix = 0;
|
2005-04-15 19:37:05 +04:00
|
|
|
}
|
2005-12-02 00:15:20 +03:00
|
|
|
/* -d -r should imply -t, but -d by itself should not have to. */
|
|
|
|
if ( (LS_TREE_ONLY|LS_RECURSIVE) ==
|
|
|
|
((LS_TREE_ONLY|LS_RECURSIVE) & ls_options))
|
|
|
|
ls_options |= LS_SHOW_TREES;
|
2005-04-15 19:37:05 +04:00
|
|
|
|
2009-11-14 07:34:08 +03:00
|
|
|
if (argc < 1)
|
|
|
|
usage_with_options(ls_tree_usage, ls_tree_options);
|
2017-05-07 01:10:34 +03:00
|
|
|
if (get_oid(argv[0], &oid))
|
2009-11-14 07:34:08 +03:00
|
|
|
die("Not a valid object name %s", argv[0]);
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 11:05:38 +04:00
|
|
|
|
2013-07-14 12:35:31 +04:00
|
|
|
/*
|
|
|
|
* show_recursive() rolls its own matching code and is
|
|
|
|
* generally ignorant of 'struct pathspec'. The magic mask
|
|
|
|
* cannot be lifted until it is converted to use
|
2014-01-24 17:40:30 +04:00
|
|
|
* match_pathspec() or tree_entry_interesting()
|
2013-07-14 12:35:31 +04:00
|
|
|
*/
|
2017-01-04 21:03:59 +03:00
|
|
|
parse_pathspec(&pathspec, PATHSPEC_ALL_MAGIC &
|
|
|
|
~(PATHSPEC_FROMTOP | PATHSPEC_LITERAL),
|
2013-07-14 12:35:31 +04:00
|
|
|
PATHSPEC_PREFER_CWD,
|
|
|
|
prefix, argv + 1);
|
2011-03-25 12:34:19 +03:00
|
|
|
for (i = 0; i < pathspec.nr; i++)
|
2012-11-18 13:13:06 +04:00
|
|
|
pathspec.items[i].nowildcard_len = pathspec.items[i].len;
|
2011-04-05 20:30:36 +04:00
|
|
|
pathspec.has_wildcard = 0;
|
2017-05-07 01:10:37 +03:00
|
|
|
tree = parse_tree_indirect(&oid);
|
2006-01-26 09:13:36 +03:00
|
|
|
if (!tree)
|
2005-11-26 20:38:20 +03:00
|
|
|
die("not a tree object");
|
2021-03-21 01:37:51 +03:00
|
|
|
return !!read_tree(the_repository, tree,
|
|
|
|
&pathspec, show_tree, NULL);
|
2005-04-13 13:02:34 +04:00
|
|
|
}
|