diff options
author | Junio C Hamano <junkio@cox.net> | 2005-12-23 13:39:30 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-12-23 14:01:32 -0800 |
commit | a69dd585fca9ab7fc4a07f7563f6cdb106e3ffed (patch) | |
tree | 67eb743f741d0b8457adfd0fceaae5b7822ffa1c /git-checkout.sh | |
parent | 797bd6f490c91c07986382b9f268e0df712cb246 (diff) | |
download | git-a69dd585fca9ab7fc4a07f7563f6cdb106e3ffed.tar.gz git-a69dd585fca9ab7fc4a07f7563f6cdb106e3ffed.tar.xz |
ls-tree: chomp leading directories when run from a subdirectory
When run from a subdirectory, even though we filtered the output
based on where we were using pathspec, we wrote out the
repository relative paths, not subtree relative paths. This
changes things so that it shows only the current subdirectory
relative paths.
For example, in Documentation subdirectory of git itself, this
used to be the case:
$ git-ls-tree --name-only HEAD | grep how
Documentation/git-show-branch.txt
Documentation/git-show-index.txt
Documentation/howto-index.sh
Documentation/howto
But now it does this instead:
$ git-ls-tree --name-only HEAD | grep how
git-show-branch.txt
git-show-index.txt
howto-index.sh
howto
There are two things to keep in mind.
1. This shows nothing.
$ git-ls-tree --name-only HEAD ../ppc/
This is to make things consistent with ls-files, which
refuses relative path that goes uplevel.
2. These show things in full repository relative paths. In this
case, paths outside the current subdirectory are also shown.
$ git-ls-tree --name-only --full-name HEAD | grep how
Documentation/git-show-branch.txt
Documentation/git-show-index.txt
Documentation/howto-index.sh
Documentation/howto
$ git-ls-tree --name-only --full-name HEAD ../ppc/
ppc/sha1.c
ppc/sha1.h
ppc/sha1ppc.S
The flag --full-name gives the same behaviour as 1.0, so it
ought to be the default if we really care about the backward
compatibility, but in practice no Porcelain runs ls-tree from a
subdirectory yet, and without --full-name is more human
friendly, so hopefully the default being not --full-name would
be acceptable.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-checkout.sh')
0 files changed, 0 insertions, 0 deletions