Re: [PATCH 6/8] ls-tree: work from subdirectory.
- From
Junio C Hamano <junkio@cox.net>
- Date
- Nov 27, 2005, 09:21 UTC
- Message-ID
- <7vr792fnta.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.64.0511251953081.13959@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
Show 9 quoted lines
> And this is just ugly. > > git-ls-tree should be rewritten to use a pathspec the same way everybody > else does. Right now it's the odd man out: if you do > > git-ls-tree HEAD divers/char drivers/ > > it will show the same files _twice_, which is not how pathspecs in general > work.
True; that is more or less deliberate. The behaviour is modelled after what "/bin/ls -a" does.
> How about this patch? It breaks some of the git-ls-tree tests, but it > makes git-ls-tree work a lot more like other git pathspec commands, and it > removes more than 150 lines by re-using the recursive tree traversal (but > the "-d" flag is gone for good, so I'm not pushing this too hard).
I am all for it if it were just me, and all the more so for its cleanup value. I do not think anybody uses "-d" (none of Cogito, StGIT nor gitweb seems to use it, and I have not seen Jason McMullan, who wanted to have a way in ls-tree to see just the object name of a subtree, on the list for a while); I suspect that nobody would miss that option.
However, this patch changes its behaviour in another way, and that could impact Porcelains more than the removal of the "-d" option. Currently, "git-ls-tree <tree> $dir" shows what "/bin/ls -a -1 $dir" would show --- the tree for $dir itself and its immediate children. This patch changes it to show the tree for $dir and nothing else. In effect, "-d" becomes the default that you cannot turn off, except using "-r" to allow it go all the way down.
I do not think StGIT is affected; it does not use ls-tree at all. gitweb is not affected either. It does not use paths specifier.
Cogito might need a slight adjustment.
- cg-admin-cat may want to use -r for the first one (${ARGS[@]}
may name a directory), but that also would change the
behaviour. The current one shows only one level, instead of
going all the way down.- cg-log:117 uses ls-tree without -r, but I have a feeling that it might be just a bug, even with the current ls-tree; I suspect the user would not see things in subdirectories. This is only for the initial commit so it may or may not matter much.
- cg-restore already uses ls-tree -r so that would not be affected.