2005-05-11 01:32:30 +04:00
|
|
|
git-ls-tree(1)
|
|
|
|
==============
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2007-01-19 02:53:37 +03:00
|
|
|
git-ls-tree - List the contents of a tree object
|
2005-05-11 01:32:30 +04:00
|
|
|
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
2006-06-07 23:46:55 +04:00
|
|
|
[verse]
|
2008-06-30 10:09:04 +04:00
|
|
|
'git ls-tree' [-d] [-r] [-t] [-l] [-z]
|
2010-10-08 21:31:15 +04:00
|
|
|
[--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]]
|
|
|
|
<tree-ish> [<path>...]
|
2005-05-11 01:32:30 +04:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2005-12-05 02:31:08 +03:00
|
|
|
Lists the contents of a given tree object, like what "/bin/ls -a" does
|
2008-07-28 13:33:33 +04:00
|
|
|
in the current working directory. Note that:
|
|
|
|
|
|
|
|
- the behaviour is slightly different from that of "/bin/ls" in that the
|
2010-10-08 21:31:15 +04:00
|
|
|
'<path>' denotes just a list of patterns to match, e.g. so specifying
|
2016-06-28 14:40:10 +03:00
|
|
|
directory name (without `-r`) will behave differently, and order of the
|
2008-07-28 13:33:33 +04:00
|
|
|
arguments does not matter.
|
|
|
|
|
2010-10-08 21:31:15 +04:00
|
|
|
- the behaviour is similar to that of "/bin/ls" in that the '<path>' is
|
2008-07-28 13:33:33 +04:00
|
|
|
taken as relative to the current working directory. E.g. when you are
|
|
|
|
in a directory 'sub' that has a directory 'dir', you can run 'git
|
|
|
|
ls-tree -r HEAD dir' to list the contents of the tree (that is
|
2016-06-28 14:40:15 +03:00
|
|
|
'sub/dir' in `HEAD`). You don't want to give a tree that is not at the
|
2010-01-07 19:49:12 +03:00
|
|
|
root level (e.g. `git ls-tree -r HEAD:sub dir`) in this case, as that
|
2016-06-28 14:40:15 +03:00
|
|
|
would result in asking for 'sub/sub/dir' in the `HEAD` commit.
|
2008-12-31 13:00:50 +03:00
|
|
|
However, the current working directory can be ignored by passing
|
|
|
|
--full-tree option.
|
2005-05-11 01:32:30 +04:00
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
-------
|
|
|
|
<tree-ish>::
|
2005-08-05 19:05:02 +04:00
|
|
|
Id of a tree-ish.
|
2005-05-11 01:32:30 +04:00
|
|
|
|
[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
|
|
|
-d::
|
2005-12-05 02:31:08 +03:00
|
|
|
Show only the named tree entry itself, not its children.
|
[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-05-11 01:32:30 +04:00
|
|
|
-r::
|
2005-12-05 02:31:08 +03:00
|
|
|
Recurse into sub-trees.
|
|
|
|
|
|
|
|
-t::
|
|
|
|
Show tree entries even when going to recurse them. Has no effect
|
2016-06-28 14:40:10 +03:00
|
|
|
if `-r` was not passed. `-d` implies `-t`.
|
2005-05-11 01:32:30 +04:00
|
|
|
|
2007-05-20 00:08:11 +04:00
|
|
|
-l::
|
|
|
|
--long::
|
|
|
|
Show object size of blob (file) entries.
|
|
|
|
|
2005-05-11 01:32:30 +04:00
|
|
|
-z::
|
2005-12-05 02:31:08 +03:00
|
|
|
\0 line termination on output.
|
|
|
|
|
|
|
|
--name-only::
|
|
|
|
--name-status::
|
|
|
|
List only filenames (instead of the "long" output), one per line.
|
2005-05-11 01:32:30 +04:00
|
|
|
|
2006-03-07 16:52:02 +03:00
|
|
|
--abbrev[=<n>]::
|
|
|
|
Instead of showing the full 40-byte hexadecimal object
|
2009-01-12 23:02:07 +03:00
|
|
|
lines, show only a partial prefix.
|
2006-03-07 16:52:02 +03:00
|
|
|
Non default number of digits can be specified with --abbrev=<n>.
|
|
|
|
|
2006-06-07 23:46:55 +04:00
|
|
|
--full-name::
|
2006-06-08 03:29:36 +04:00
|
|
|
Instead of showing the path names relative to the current working
|
2006-06-07 23:46:55 +04:00
|
|
|
directory, show the full path names.
|
|
|
|
|
2008-12-31 13:00:50 +03:00
|
|
|
--full-tree::
|
|
|
|
Do not limit the listing to the current working directory.
|
|
|
|
Implies --full-name.
|
|
|
|
|
2010-10-08 21:31:15 +04:00
|
|
|
[<path>...]::
|
2005-12-05 02:31:08 +03:00
|
|
|
When paths are given, show them (note that this isn't really raw
|
|
|
|
pathnames, but rather a list of patterns to match). Otherwise
|
|
|
|
implicitly uses the root level of the tree as the sole path argument.
|
[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-05-26 21:52:50 +04:00
|
|
|
|
2005-05-11 01:32:30 +04:00
|
|
|
Output Format
|
|
|
|
-------------
|
[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
|
|
|
<mode> SP <type> SP <object> TAB <file>
|
2005-05-11 01:32:30 +04:00
|
|
|
|
2009-05-10 20:13:45 +04:00
|
|
|
Unless the `-z` option is used, TAB, LF, and backslash characters
|
2005-12-05 02:31:08 +03:00
|
|
|
in pathnames are represented as `\t`, `\n`, and `\\`, respectively.
|
2010-01-07 19:49:12 +03:00
|
|
|
This output format is compatible with what `--index-info --stdin` of
|
2009-05-10 20:14:49 +04:00
|
|
|
'git update-index' expects.
|
2005-10-15 08:56:46 +04:00
|
|
|
|
2007-05-20 00:08:11 +04:00
|
|
|
When the `-l` option is used, format changes to
|
|
|
|
|
|
|
|
<mode> SP <type> SP <object> SP <object size> TAB <file>
|
|
|
|
|
|
|
|
Object size identified by <object> is given in bytes, and right-justified
|
|
|
|
with minimum width of 7 characters. Object size is given only for blobs
|
|
|
|
(file) entries; for other entries `-` character is used in place of size.
|
|
|
|
|
2005-05-11 01:32:30 +04:00
|
|
|
GIT
|
|
|
|
---
|
2008-06-06 11:07:32 +04:00
|
|
|
Part of the linkgit:git[1] suite
|