Merge branch 'jc/maint-ls-tree'

* jc/maint-ls-tree:
  Document git-ls-tree --full-tree
  ls-tree: add --full-tree option
This commit is contained in:
Junio C Hamano 2009-01-13 23:09:57 -08:00
commit 350b1091a8
2 changed files with 13 additions and 2 deletions

View File

@ -10,7 +10,7 @@ SYNOPSIS
-------- --------
[verse] [verse]
'git ls-tree' [-d] [-r] [-t] [-l] [-z] 'git ls-tree' [-d] [-r] [-t] [-l] [-z]
[--name-only] [--name-status] [--full-name] [--abbrev=[<n>]] [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev=[<n>]]
<tree-ish> [paths...] <tree-ish> [paths...]
DESCRIPTION DESCRIPTION
@ -30,6 +30,8 @@ in the current working directory. Note that:
'sub/dir' in 'HEAD'). You don't want to give a tree that is not at the 'sub/dir' in 'HEAD'). You don't want to give a tree that is not at the
root level (e.g. 'git ls-tree -r HEAD:sub dir') in this case, as that root level (e.g. 'git ls-tree -r HEAD:sub dir') in this case, as that
would result in asking for 'sub/sub/dir' in the 'HEAD' commit. would result in asking for 'sub/sub/dir' in the 'HEAD' commit.
However, the current working directory can be ignored by passing
--full-tree option.
OPTIONS OPTIONS
------- -------
@ -66,6 +68,10 @@ OPTIONS
Instead of showing the path names relative to the current working Instead of showing the path names relative to the current working
directory, show the full path names. directory, show the full path names.
--full-tree::
Do not limit the listing to the current working directory.
Implies --full-name.
paths:: paths::
When paths are given, show them (note that this isn't really raw When paths are given, show them (note that this isn't really raw
pathnames, but rather a list of patterns to match). Otherwise pathnames, but rather a list of patterns to match). Otherwise

View File

@ -23,7 +23,7 @@ static int chomp_prefix;
static const char *ls_tree_prefix; static const char *ls_tree_prefix;
static const char ls_tree_usage[] = static const char ls_tree_usage[] =
"git ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--abbrev[=<n>]] <tree-ish> [path...]"; "git ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]] <tree-ish> [path...]";
static int show_recursive(const char *base, int baselen, const char *pathname) static int show_recursive(const char *base, int baselen, const char *pathname)
{ {
@ -156,6 +156,11 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
chomp_prefix = 0; chomp_prefix = 0;
break; break;
} }
if (!strcmp(argv[1]+2, "full-tree")) {
ls_tree_prefix = prefix = NULL;
chomp_prefix = 0;
break;
}
if (!prefixcmp(argv[1]+2, "abbrev=")) { if (!prefixcmp(argv[1]+2, "abbrev=")) {
abbrev = strtoul(argv[1]+9, NULL, 10); abbrev = strtoul(argv[1]+9, NULL, 10);
if (abbrev && abbrev < MINIMUM_ABBREV) if (abbrev && abbrev < MINIMUM_ABBREV)