<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/ls-tree.c, branch v1.2.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.2.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.2.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2006-01-26T09:08:29Z</updated>
<entry>
<title>Only use a single parser for tree objects</title>
<updated>2006-01-26T09:08:29Z</updated>
<author>
<name>Daniel Barkalow</name>
<email>barkalow@iabervon.org</email>
</author>
<published>2006-01-26T06:13:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=521698b1538fb3c9bd818ee98f2c17d2c80c9605'/>
<id>urn:sha1:521698b1538fb3c9bd818ee98f2c17d2c80c9605</id>
<content type='text'>
This makes read_tree_recursive and read_tree take a struct tree
instead of a buffer. It also move the declaration of read_tree into
tree.h (where struct tree is defined), and updates ls-tree and
diff-index (the only places that presently use read_tree*()) to use
the new versions.

Signed-off-by: Daniel Barkalow &lt;barkalow@iabervon.org&gt;
Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>ls-tree: chomp leading directories when run from a subdirectory</title>
<updated>2005-12-23T22:01:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>junkio@cox.net</email>
</author>
<published>2005-12-23T21:39:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a69dd585fca9ab7fc4a07f7563f6cdb106e3ffed'/>
<id>urn:sha1:a69dd585fca9ab7fc4a07f7563f6cdb106e3ffed</id>
<content type='text'>
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 &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>ls-tree: --name-only</title>
<updated>2005-12-01T22:54:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>junkio@cox.net</email>
</author>
<published>2005-12-01T22:54:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c639a5548a5d8414b55202592885449f66ee2f33'/>
<id>urn:sha1:c639a5548a5d8414b55202592885449f66ee2f33</id>
<content type='text'>
Fingers of some "git diff" users are trained to do --name-only
which git-ls-tree unfortunately does not take.  With this,

	cd sub/directory &amp;&amp; git-ls-tree -r --name-only ..

would show only the names not object names nor modes.  I threw
in another synonym --name-status only for usability, but
obviously ls-tree does not do any comparison so what it does is
the same as --name-only.

Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>ls-tree: resurrect '-d' to mean 'show trees only'</title>
<updated>2005-12-01T22:43:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>junkio@cox.net</email>
</author>
<published>2005-12-01T21:15:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f59846718ed98e153c0423eaa5f7ff0526d2a6f8'/>
<id>urn:sha1:f59846718ed98e153c0423eaa5f7ff0526d2a6f8</id>
<content type='text'>
With this:

	git-ls-tree -d HEAD -- drivers/net/

shows only immediate subtrees of drivers/net.

	git-ls-tree -d -t HEAD -- drivers/net/

shows drivers, drivers/net and immediate subtrees of
drivers/net.

	git-ls-tree -d -r HEAD -- drivers/net/

shows drivers, drivers/net and all subtrees of drivers/net (but
not blobs).

Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>git-ls-tree: add "-t" option to always show the tree entries</title>
<updated>2005-12-01T20:27:22Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@osdl.org</email>
</author>
<published>2005-12-01T18:35:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0f8f45cb4a7e664b396f73c25891da46b953b8b8'/>
<id>urn:sha1:0f8f45cb4a7e664b396f73c25891da46b953b8b8</id>
<content type='text'>
The old (new) behaviour was that it only shows trees if the object is
specified exactly, and recursive is not set. That makes sense, because
there is obviously nothing else it can show for that case.

However, with the new "-t" option, it will show the tree even with "-r",
as it traverses down into it.

NOTE! This also means that it will show all trees leading up to that tree.

For example, if you do a

	git-ls-tree -t HEAD -- drivers/char/this/file/does/not/exist

it will show the trees that lead up to the files that do not exist:

	[torvalds@g5 linux]$ git-ls-tree -t HEAD -- drivers/char/this/file/does/not/exist
	040000 tree 9cb687b77dcd64bf82e9a73214db467c964c1266    drivers
	040000 tree 298e2fadf0ff3867d1ef49936fd2c7bf6ce1eb66    drivers/char
	[torvalds@g5 linux]$

and note how this is true even though I didn't specify "-r": the fact that
I supplied a pathspec automatically implies "enough recursion" for that
particular pathspec.

I think the code is cleaner and easier to understand too: the patch looks
bigger, but it's really just splitting up the "should we recurse into this
tree" into a function of its own.

Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>ls-tree: Resurrect funny name quoting lost during rewrite.</title>
<updated>2005-11-29T07:03:12Z</updated>
<author>
<name>Junio C Hamano</name>
<email>junkio@cox.net</email>
</author>
<published>2005-11-28T10:30:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=32b5904b5f94829aa7ae11b585ca9c639d57cc74'/>
<id>urn:sha1:32b5904b5f94829aa7ae11b585ca9c639d57cc74</id>
<content type='text'>
The rewrite to match ls-files/diff-tree behaviour accidentally
lost the name quoting.  I am not proud about this code, but this
would get the test going.

Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>ls-tree: further tweaks of the rewrite</title>
<updated>2005-11-29T07:00:14Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@osdl.org</email>
</author>
<published>2005-11-28T06:48:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e2466376ec9a8508b4c8ba2b0c29945c5bfc6cc2'/>
<id>urn:sha1:e2466376ec9a8508b4c8ba2b0c29945c5bfc6cc2</id>
<content type='text'>
It modifies the selection a bit, so that a pathspec that is a superset of
a particular tree path will always cause it to recurse into that tree.

As an example, let's say that we do

	git-ls-tree HEAD drivers/char

_without_ the "-r". What will happen is that it will start out doing all
the base tree, and for "drivers" it will notice that it's a proper subset
of "drivers/char", so it will always recurse into _that_ tree (but not
into other trees).

Then, it will not match anything else than "char" in that subdirectory,
and because that's not a proper superset (it's an exact match), it will
_not_ recurse into it, so you get:

	[torvalds@g5 linux]$ ~/git/git-ls-tree HEAD drivers/char
	040000 tree 9568cda453aae205bb58983747fa73b9696d9d51    drivers/char

which is what you got with the old git-ls-tree too.

But interestingly, if you add the slash, it will become a proper superset
and it will recurse into _that_ subdirectory (but no deeper: so if you
want all subdirectories _below_ drivers/char/, you still need to give
"-r"):

	[torvalds@g5 linux]$ ~/git/git-ls-tree HEAD drivers/char/
	100644 blob 2b6b1d772ed776fff87927fc34adc2e40500218e    drivers/char/.gitignore
	100644 blob 56b8a2e76ab10a5c21787cb7068a846075cbaffd    drivers/char/ChangeLog
	100644 blob 970f70d498f4c814e1cf3362e33d7e23ac53c299    drivers/char/Kconfig
	...

See? This is on top of the previous two diffs, holler if you want a whole
new "everything combined" version..

It hasn't gotten lots of testing, but it should work.

		Linus
</content>
</entry>
<entry>
<title>ls-tree: further cleanup to parallel ls-files.</title>
<updated>2005-11-29T07:00:14Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@osdl.org</email>
</author>
<published>2005-11-27T19:00:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b45c569b6f257d8905acd8313224dc086266f602'/>
<id>urn:sha1:b45c569b6f257d8905acd8313224dc086266f602</id>
<content type='text'>
To get more a "git-ls-files" approach, this trivial patch (on top of my
previous one) enables recursion, and doesn't show partial trees.

[jc: after further discussion, this version enables recursion by default,
 and you can disable it with "-d" flag.

	git-ls-tree -d HEAD Documentation/no/such/directory

 shows Documentation tree (without -d it shows nothing).

	git-ls-tree HEAD

 shows everything from the tree.  Only to get the single level from the top

	git-ls-tree -d HEAD

 is needed.  But there is no way to get the single level with pathspec.
 You need to extract the object name of Documentation tree from the parent
 tree and run

	git-ls-tree -d $tree_id_of_Documentation_tree

 to get something similar to what you can get from the current

	git-ls-tree HEAD Documentation
 ]
</content>
</entry>
<entry>
<title>ls-tree: major rewrite to do pathspec</title>
<updated>2005-11-29T07:00:14Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@osdl.org</email>
</author>
<published>2005-11-26T17:38:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3c5e8468a93cdb427b4c4a129339e80e1813e5c0'/>
<id>urn:sha1:3c5e8468a93cdb427b4c4a129339e80e1813e5c0</id>
<content type='text'>
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.

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).

		Linus
</content>
</entry>
<entry>
<title>write_name_quoted(): make one of the path a counted string.</title>
<updated>2005-11-29T06:55:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>junkio@cox.net</email>
</author>
<published>2005-11-29T06:55:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ef2b3cbf62d15aa0312bde349347873d7c0f399'/>
<id>urn:sha1:9ef2b3cbf62d15aa0312bde349347873d7c0f399</id>
<content type='text'>
This is to prepare for ls-tree updates.

Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
</feed>
