1. Stefan Saasen
  2. git


Junio C Hamano  committed 32fe027 Merge

Merge branch 'jc/maint-ls-tree' into maint

* jc/maint-ls-tree:
Document git-ls-tree --full-tree
ls-tree: add --full-tree option

  • Participants
  • Parent commits 8e7d1f6, e1a5977
  • Branches master

Comments (0)

Files changed (2)

File Documentation/git-ls-tree.txt

View file
 '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...]
    '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
    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.
 	Instead of showing the path names relative to the current working
 	directory, show the full path names.
+	Do not limit the listing to the current working directory.
+	Implies --full-name.
 	When paths are given, show them (note that this isn't really raw
 	pathnames, but rather a list of patterns to match).  Otherwise

File builtin-ls-tree.c

View file
 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[=<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)
 				chomp_prefix = 0;
+			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)