<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/list-objects.c, branch v2.16.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.16.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.16.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-12-28T22:08:50Z</updated>
<entry>
<title>Merge branch 'sb/describe-blob'</title>
<updated>2017-12-28T22:08:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-12-28T22:08:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=556de1a8e38ff03d31fd35751582447001f39d0c'/>
<id>urn:sha1:556de1a8e38ff03d31fd35751582447001f39d0c</id>
<content type='text'>
"git describe" was taught to dig trees deeper to find a
&lt;commit-ish&gt;:&lt;path&gt; that refers to a given blob object.

* sb/describe-blob:
  builtin/describe.c: describe a blob
  builtin/describe.c: factor out describe_commit
  builtin/describe.c: print debug statements earlier
  builtin/describe.c: rename `oid` to avoid variable shadowing
  revision.h: introduce blob/tree walking in order of the commits
  list-objects.c: factor out traverse_trees_and_blobs
  t6120: fix typo in test name
</content>
</entry>
<entry>
<title>list-objects: filter objects in traverse_commit_list</title>
<updated>2017-11-22T05:11:57Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhost@microsoft.com</email>
</author>
<published>2017-11-21T20:58:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=25ec7bcac044057900a0f3c9a8d6ccbb41a066bc'/>
<id>urn:sha1:25ec7bcac044057900a0f3c9a8d6ccbb41a066bc</id>
<content type='text'>
Create traverse_commit_list_filtered() and add filtering
interface to allow certain objects to be omitted from the
traversal.

Update traverse_commit_list() to be a wrapper for the above
with a null filter to minimize the number of callers that
needed to be changed.

Object filtering will be used in a future commit by rev-list
and pack-objects for partial clone and fetch to omit unwanted
objects from the result.

traverse_bitmap_commit_list() does not work with filtering.
If a packfile bitmap is present, it will not be used.  It
should be possible to extend such support in the future (at
least to simple filters that do not require object pathnames),
but that is beyond the scope of this patch series.

Signed-off-by: Jeff Hostetler &lt;jeffhost@microsoft.com&gt;
Reviewed-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>revision.h: introduce blob/tree walking in order of the commits</title>
<updated>2017-11-16T02:12:51Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2017-11-16T02:00:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ce5b6f9be84690ba38eba10c42b3f7c7e2511abb'/>
<id>urn:sha1:ce5b6f9be84690ba38eba10c42b3f7c7e2511abb</id>
<content type='text'>
The functionality to list tree objects in the order they were seen
while traversing the commits will be used in one of the next commits,
where we teach `git describe` to describe not only commits, but blobs, too.

The change in list-objects.c is rather minimal as we'll be re-using
the infrastructure put in place of the revision walking machinery. For
example one could expect that add_pending_tree is not called, but rather
commit-&gt;tree is directly passed to the tree traversal function. This
however requires a lot more code than just emptying the queue containing
trees after each commit.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>list-objects.c: factor out traverse_trees_and_blobs</title>
<updated>2017-11-03T14:12:06Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2017-11-02T19:41:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=91904f5645196ceef92c6fca21cc9454928613f0'/>
<id>urn:sha1:91904f5645196ceef92c6fca21cc9454928613f0</id>
<content type='text'>
With traverse_trees_and_blobs factored out of the main traverse function,
the next patch can introduce an in-order revision walking with ease.

In the next patch we'll call `traverse_trees_and_blobs` from within the
loop walking the commits, such that we'll have one invocation of that
function per commit.  That is why we do not want to have memory allocations
in that function, such as we'd have if we were to use a strbuf locally.
Pass a strbuf from traverse_commit_list into the blob and tree traversing
function as a scratch pad that only needs to be allocated once.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Convert lookup_tree to struct object_id</title>
<updated>2017-05-08T06:12:57Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2017-05-06T22:10:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=740ee055c6178fc2dd43c5ccfbd367c4c64d6e0d'/>
<id>urn:sha1:740ee055c6178fc2dd43c5ccfbd367c4c64d6e0d</id>
<content type='text'>
Convert the lookup_tree function to take a pointer to struct object_id.

The commit was created with manual changes to tree.c, tree.h, and
object.c, plus the following semantic patch:

@@
@@
- lookup_tree(EMPTY_TREE_SHA1_BIN)
+ lookup_tree(&amp;empty_tree_oid)

@@
expression E1;
@@
- lookup_tree(E1.hash)
+ lookup_tree(&amp;E1)

@@
expression E1;
@@
- lookup_tree(E1-&gt;hash)
+ lookup_tree(E1)

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Convert lookup_blob to struct object_id</title>
<updated>2017-05-08T06:12:57Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2017-05-06T22:10:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3aca1fc6c9c69fbfce0e6312fc8e3087cb6334a4'/>
<id>urn:sha1:3aca1fc6c9c69fbfce0e6312fc8e3087cb6334a4</id>
<content type='text'>
Convert lookup_blob to take a pointer to struct object_id.

The commit was created with manual changes to blob.c and blob.h, plus
the following semantic patch:

@@
expression E1;
@@
- lookup_blob(E1.hash)
+ lookup_blob(&amp;E1)

@@
expression E1;
@@
- lookup_blob(E1-&gt;hash)
+ lookup_blob(E1)

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>struct name_entry: use struct object_id instead of unsigned char sha1[20]</title>
<updated>2016-04-25T21:23:42Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2016-04-17T23:10:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7d924c9139e33e7599d7aed0446e634c427a5f15'/>
<id>urn:sha1:7d924c9139e33e7599d7aed0446e634c427a5f15</id>
<content type='text'>
Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>list-objects: pass full pathname to callbacks</title>
<updated>2016-02-12T20:51:17Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-11T22:28:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=de1e67d0703894cb6ea782e36abb63976ab07e60'/>
<id>urn:sha1:de1e67d0703894cb6ea782e36abb63976ab07e60</id>
<content type='text'>
When we find a blob at "a/b/c", we currently pass this to
our show_object_fn callbacks as two components: "a/b/" and
"c". Callbacks which want the full value then call
path_name(), which concatenates the two. But this is an
inefficient interface; the path is a strbuf, and we could
simply append "c" to it temporarily, then roll back the
length, without creating a new copy.

So we could improve this by teaching the callsites of
path_name() this trick (and there are only 3). But we can
also notice that no callback actually cares about the
broken-down representation, and simply pass each callback
the full path "a/b/c" as a string. The callback code becomes
even simpler, then, as we do not have to worry about freeing
an allocated buffer, nor rolling back our modification to
the strbuf.

This is theoretically less efficient, as some callbacks
would not bother to format the final path component. But in
practice this is not measurable. Since we use the same
strbuf over and over, our work to grow it is amortized, and
we really only pay to memcpy a few bytes.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>list-objects: drop name_path entirely</title>
<updated>2016-02-12T20:51:15Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-11T22:26:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bd64516aca4d4e22acb33c71429d293a14d355cf'/>
<id>urn:sha1:bd64516aca4d4e22acb33c71429d293a14d355cf</id>
<content type='text'>
In the previous commit, we left name_path as a thin wrapper
around a strbuf. This patch drops it entirely. As a result,
every show_object_fn callback needs to be adjusted. However,
none of their code needs to be changed at all, because the
only use was to pass it to path_name(), which now handles
the bare strbuf.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>list-objects: convert name_path to a strbuf</title>
<updated>2016-02-12T20:51:10Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-11T22:26:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=13528ab37cadb4d4f7384d0449489760912904b8'/>
<id>urn:sha1:13528ab37cadb4d4f7384d0449489760912904b8</id>
<content type='text'>
The "struct name_path" data is examined in only two places:
we generate it in process_tree(), and we convert it to a
single string in path_name(). Everyone else just passes it
through to those functions.

We can further note that process_tree() already keeps a
single strbuf with the leading tree path, for use with
tree_entry_interesting().

Instead of building a separate name_path linked list, let's
just use the one we already build in "base". This reduces
the amount of code (especially tricky code in path_name()
which did not check for integer overflows caused by deep
or large pathnames).

It is also more efficient in some instances.  Any time we
were using tree_entry_interesting, we were building up the
strbuf anyway, so this is an immediate and obvious win
there. In cases where we were not, we trade off storing
"pathname/" in a strbuf on the heap for each level of the
path, instead of two pointers and an int on the stack (with
one pointer into the tree object). On a 64-bit system, the
latter is 20 bytes; so if path components are less than that
on average, this has lower peak memory usage.  In practice
it probably doesn't matter either way; we are already
holding in memory all of the tree objects leading up to each
pathname, and for normal-depth pathnames, we are only
talking about hundreds of bytes.

This patch leaves "struct name_path" as a thin wrapper
around the strbuf, to avoid disrupting callbacks. We should
fix them, but leaving it out makes this diff easier to view.

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