@matheusbsbs / matheus-bagliano / commits / 7ddea13af2
Fork 0

ls-tree documentation: enhance notes on subdirectory and pathspec behaviour

When run in a working copy subdirectory, git-ls-tree will automagically add the prefix to the pathspec, which can result in an unexpected behavior when the tree object accessed is not the root tree object. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jul 28, 2008 at 02:33 UTC 7ddea13af24d72deca06a779b1827a8ea2d6cfe6
1 file changed +14 -4
Documentation/git-ls-tree.txt
+14 -4
@@ -16,10 +16,20 @@ SYNOPSIS
16 DESCRIPTION
17 -----------
18 Lists the contents of a given tree object, like what "/bin/ls -a" does
19 -in the current working directory. Note that the usage is subtly different,
20 -though - 'paths' denote just a list of patterns to match, e.g. so specifying
21 -directory name (without '-r') will behave differently, and order of the
22 -arguments does not matter.
19 +in the current working directory. Note that:
20 +
21 + - the behaviour is slightly different from that of "/bin/ls" in that the
22 + 'paths' denote just a list of patterns to match, e.g. so specifying
23 + directory name (without '-r') will behave differently, and order of the
24 + arguments does not matter.
25 +
26 + - the behaviour is similar to that of "/bin/ls" in that the 'paths' is
27 + taken as relative to the current working directory. E.g. when you are
28 + in a directory 'sub' that has a directory 'dir', you can run 'git
29 + ls-tree -r HEAD dir' to list the contents of the tree (that is
30 + 'sub/dir' in 'HEAD'). You don't want to give a tree that is not at the
31 + root level (e.g. 'git ls-tree -r HEAD:sub dir') in this case, as that
32 + would result in asking for 'sub/sub/dir' in the 'HEAD' commit.
33
34 OPTIONS
35 -------