<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/tree-walk.c, branch v1.8.0.2</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.8.0.2</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.8.0.2'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2012-01-15T02:39:04Z</updated>
<entry>
<title>Document limited recursion pathspec matching with wildcards</title>
<updated>2012-01-15T02:39:04Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2012-01-14T09:23:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=8c69c1f92eb79a597225814781fdf1ab4be26758'/>
<id>urn:sha1:8c69c1f92eb79a597225814781fdf1ab4be26758</id>
<content type='text'>
It's actually unlimited recursion if wildcards are active regardless
--max-depth

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tree_entry_interesting: make use of local pointer "item"</title>
<updated>2011-10-27T18:38:24Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2011-10-24T06:36:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=9c6bebd14233af291ffb8dde2975b06c76e9ce5f'/>
<id>urn:sha1:9c6bebd14233af291ffb8dde2975b06c76e9ce5f</id>
<content type='text'>
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tree_entry_interesting(): give meaningful names to return values</title>
<updated>2011-10-27T18:38:24Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2011-10-24T06:36:10Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=d688cf07b15b664a2164c3d92bcb5e8265400a2b'/>
<id>urn:sha1:d688cf07b15b664a2164c3d92bcb5e8265400a2b</id>
<content type='text'>
It is a basic code hygiene to avoid magic constants that are unnamed.
Besides, this helps extending the value later on for "interesting, but
cannot decide if the entry truely matches yet" (ie. prefix matches)

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>get_tree_entry(): do not call find_tree_entry() on an empty tree</title>
<updated>2011-10-27T18:24:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-10-27T18:18:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=5fb8c05f2e5da483898019f7abc0e52e07bc0c50'/>
<id>urn:sha1:5fb8c05f2e5da483898019f7abc0e52e07bc0c50</id>
<content type='text'>
We know we will find nothing.

This incidentally squelches false warning from gcc about potentially
uninitialized usage of t.entry fields. For an empty tree, it is true that
init_tree_desc() does not call decode_tree_entry() and the tree_desc is
left uninitialized, but find_tree_entry() only calls tree_entry_extract()
that uses the tree_desc while it has more things to read from the tree, so
the uninitialized t.entry fields are never used in such a case anyway.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tree-walk.c: do not leak internal structure in tree_entry_len()</title>
<updated>2011-10-27T18:08:26Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2011-10-24T06:36:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=0de1633783685e9fb1943551217cdda7edbd245b'/>
<id>urn:sha1:0de1633783685e9fb1943551217cdda7edbd245b</id>
<content type='text'>
tree_entry_len() does not simply take two random arguments and return
a tree length. The two pointers must point to a tree item structure,
or struct name_entry. Passing random pointers will return incorrect
value.

Force callers to pass struct name_entry instead of two pointers (with
hope that they don't manually construct struct name_entry themselves)

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'dm/tree-walk'</title>
<updated>2011-10-10T22:56:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-10-10T22:56:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=4909bbe40af6dd12bc4aeb6b9e449a9e29641a26'/>
<id>urn:sha1:4909bbe40af6dd12bc4aeb6b9e449a9e29641a26</id>
<content type='text'>
* dm/tree-walk:
  tree-walk: micro-optimization in tree_entry_interesting
  tree-walk: drop unused parameter from match_dir_prefix
</content>
</entry>
<entry>
<title>Fix some "variable might be used uninitialized" warnings</title>
<updated>2011-10-09T20:28:04Z</updated>
<author>
<name>Ramsay Jones</name>
<email>ramsay@ramsay1.demon.co.uk</email>
</author>
<published>2011-09-11T19:39:32Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=27c0f768843b6d844674f1fb8dc2676d830b56e3'/>
<id>urn:sha1:27c0f768843b6d844674f1fb8dc2676d830b56e3</id>
<content type='text'>
In particular, gcc complains as follows:

        CC tree-walk.o
    tree-walk.c: In function `traverse_trees':
    tree-walk.c:347: warning: 'e' might be used uninitialized in this \
        function

        CC builtin/revert.o
    builtin/revert.c: In function `verify_opt_mutually_compatible':
    builtin/revert.c:113: warning: 'opt2' might be used uninitialized in \
        this function

Signed-off-by: Ramsay Jones &lt;ramsay@ramsay1.demon.co.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tree-walk: micro-optimization in tree_entry_interesting</title>
<updated>2011-09-29T01:26:12Z</updated>
<author>
<name>Dan McGee</name>
<email>dpmcgee@gmail.com</email>
</author>
<published>2011-09-09T02:02:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=1b74092373898a53885cfb7e89aa54f9329a92d3'/>
<id>urn:sha1:1b74092373898a53885cfb7e89aa54f9329a92d3</id>
<content type='text'>
In the case of a wide breadth top-level tree (~2400 entries, all trees
in this case), we can see a noticeable cost in the profiler calling
strncmp() here. Most of the time we are at the base level of the
repository, so base is "" and baselen == 0, which means we will always
test true. Break out this one tiny case so we can short circuit the
strncmp() call.

Test cases are as follows. packages.git is the Arch Linux git-svn clone
of the packages repository which has the characteristics above.

Commands:
[1] packages.git, /usr/bin/time git log &gt;/dev/null
[2] packages.git, /usr/bin/time git log -- autogen/trunk pacman/trunk wget/trunk &gt;/dev/null
[3] linux.git, /usr/bin/time git log &gt;/dev/null
[4] linux.git, /usr/bin/time git log -- drivers/ata drivers/uio tools &gt;/dev/null

Results:
     before  after  %faster
[1]   2.56    2.55   0.4%
[2]  51.82   48.66   6.5%
[3]   5.58    5.61  -0.5%
[4]   1.55    1.51   0.2%

The takeaway here is this doesn't matter in many operations, but it does
for a certain style of repository and operation where it nets a 6.5%
measured improvement. The other changes are likely not significant by
reasonable statistics methods.

Note: the measured improvement when originally submitted was ~11% (43 to
38 secs) for operation [2]. At the time, the repository had 117220
commits; it now has 137537 commits.

Signed-off-by: Dan McGee &lt;dpmcgee@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tree-walk: drop unused parameter from match_dir_prefix</title>
<updated>2011-09-29T01:24:36Z</updated>
<author>
<name>Dan McGee</name>
<email>dpmcgee@gmail.com</email>
</author>
<published>2011-09-09T02:02:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=6de96915c0b12870e0cf2204fd060fb0735da728'/>
<id>urn:sha1:6de96915c0b12870e0cf2204fd060fb0735da728</id>
<content type='text'>
Signed-off-by: Dan McGee &lt;dpmcgee@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>traverse_trees(): allow pruning with pathspec</title>
<updated>2011-08-29T21:32:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-08-29T19:26:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=2842c0f914f7c05401c449db9d01276ac5a743f0'/>
<id>urn:sha1:2842c0f914f7c05401c449db9d01276ac5a743f0</id>
<content type='text'>
The traverse_trees() machinery is primarily meant for merging two (or
more) trees, and because a merge is a full tree operation, it doesn't
support any pruning with pathspec.

Since d1f2d7e (Make run_diff_index() use unpack_trees(), not read_tree(),
2008-01-19), however, we use unpack_trees() to traverse_trees() callchain
to perform "diff-index", which could waste a lot of work traversing trees
outside the user-supplied pathspec, only to discard at the blob comparison
level in diff-lib.c::oneway_diff() which is way too late.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
