Skip to content

Commit 32fe027

Browse files
committed
Merge branch 'jc/maint-ls-tree' into maint
* jc/maint-ls-tree: Document git-ls-tree --full-tree ls-tree: add --full-tree option
2 parents 8e7d1f6 + e1a5977 commit 32fe027

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Documentation/git-ls-tree.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SYNOPSIS
1010
--------
1111
[verse]
1212
'git ls-tree' [-d] [-r] [-t] [-l] [-z]
13-
[--name-only] [--name-status] [--full-name] [--abbrev=[<n>]]
13+
[--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev=[<n>]]
1414
<tree-ish> [paths...]
1515

1616
DESCRIPTION
@@ -30,6 +30,8 @@ in the current working directory. Note that:
3030
'sub/dir' in 'HEAD'). You don't want to give a tree that is not at the
3131
root level (e.g. 'git ls-tree -r HEAD:sub dir') in this case, as that
3232
would result in asking for 'sub/sub/dir' in the 'HEAD' commit.
33+
However, the current working directory can be ignored by passing
34+
--full-tree option.
3335

3436
OPTIONS
3537
-------
@@ -66,6 +68,10 @@ OPTIONS
6668
Instead of showing the path names relative to the current working
6769
directory, show the full path names.
6870

71+
--full-tree::
72+
Do not limit the listing to the current working directory.
73+
Implies --full-name.
74+
6975
paths::
7076
When paths are given, show them (note that this isn't really raw
7177
pathnames, but rather a list of patterns to match). Otherwise

builtin-ls-tree.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static int chomp_prefix;
2323
static const char *ls_tree_prefix;
2424

2525
static const char ls_tree_usage[] =
26-
"git ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--abbrev[=<n>]] <tree-ish> [path...]";
26+
"git ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]] <tree-ish> [path...]";
2727

2828
static int show_recursive(const char *base, int baselen, const char *pathname)
2929
{
@@ -156,6 +156,11 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
156156
chomp_prefix = 0;
157157
break;
158158
}
159+
if (!strcmp(argv[1]+2, "full-tree")) {
160+
ls_tree_prefix = prefix = NULL;
161+
chomp_prefix = 0;
162+
break;
163+
}
159164
if (!prefixcmp(argv[1]+2, "abbrev=")) {
160165
abbrev = strtoul(argv[1]+9, NULL, 10);
161166
if (abbrev && abbrev < MINIMUM_ABBREV)

0 commit comments

Comments
 (0)