Re: [PATCH 6/8] ls-tree: work from subdirectory.
From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:42:13
On Sun, 27 Nov 2005, Junio C Hamano wrote:
Without pathspec, ls-tree is a pretty-printing version of "git-cat-file tree", and that is how the command is used by the git browsers like gitweb. I have never looked at qgit source, but I'd be surprised if it did not depend on the single-level behaviour of ls-tree for that purpose.
You're right, we need to keep the "-r" behaviour.
Having said all of the above, I do understand why we would _also_ want the behaviour parallel to ls-files, not /bin/ls behaviour. Maybe we should have both? Either rename the current ls-tree to browse-tree, and make the one that parallels ls-files the new ls-tree?
If you take my last patch and make "ls_flags" default to 0 again, it should work correctly. The way to traverse into directories (a la qgit/webgit) is to just give the SHA1 name of the directory. Ie git-ls-tree HEAD gives us a single level, we see: ... 040000 tree b2d1264f85148d18c5ae9864d73d65737b0a1734 t ... and then we can just do git-ls-tree b2d1264f85148d18c5ae9864d73d65737b0a1734 to get that level. I assume that that is what qgit/webgit already does (I sure hope so, otherwise they're just wasting time, making the tools re-parse the trees over and over again for no gain). Linus