<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git/src/tree.h, branch cmn/remove-single-entry</title>
<subtitle>github.com: libgit2/libgit2.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/'/>
<entry>
<title>tree: drop the now-unnecessary entries vector</title>
<updated>2016-03-22T13:21:13+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@github.com</email>
</author>
<published>2016-03-22T04:18:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=e2e4bae9a091152166773fb5681f2b3acb18b43b'/>
<id>e2e4bae9a091152166773fb5681f2b3acb18b43b</id>
<content type='text'>
Remove the now-unnecessary entries vector.  Add `git_array_search`
to binary search through an array to accomplish this.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove the now-unnecessary entries vector.  Add `git_array_search`
to binary search through an array to accomplish this.
</pre>
</div>
</content>
</entry>
<entry>
<title>tree: store the entries in a growable array</title>
<updated>2016-03-20T11:01:45+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2016-03-20T11:01:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=4ed9e939e2e44d202799b2562ac95eb9da5689e3'/>
<id>4ed9e939e2e44d202799b2562ac95eb9da5689e3</id>
<content type='text'>
Take advantage of the constant size of tree-owned arrays and store them
in an array instead of a pool. This still lets us free them all at once
but lets the system allocator do the work of fitting them in.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Take advantage of the constant size of tree-owned arrays and store them
in an array instead of a pool. This still lets us free them all at once
but lets the system allocator do the work of fitting them in.
</pre>
</div>
</content>
</entry>
<entry>
<title>tree: re-use the id and filename in the odb object</title>
<updated>2016-03-20T10:00:12+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2016-03-20T10:00:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=60a194aa86d54ffb55c1abff8d0ef05647f936e8'/>
<id>60a194aa86d54ffb55c1abff8d0ef05647f936e8</id>
<content type='text'>
Instead of copying over the data into the individual entries, point to
the originals, which are already in a format we can use.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of copying over the data into the individual entries, point to
the originals, which are already in a format we can use.
</pre>
</div>
</content>
</entry>
<entry>
<title>tree: make path len uint16_t and avoid holes</title>
<updated>2015-11-28T18:21:52+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2015-11-28T18:18:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=ee42bb0e3d6534b8ac4d48df90b1bb85323972ea'/>
<id>ee42bb0e3d6534b8ac4d48df90b1bb85323972ea</id>
<content type='text'>
This reduces the size of the struct from 32 to 26 bytes, and leaves a
single padding byte at the end of the struct (which comes from the
zero-length array).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reduces the size of the struct from 32 to 26 bytes, and leaves a
single padding byte at the end of the struct (which comes from the
zero-length array).
</pre>
</div>
</content>
</entry>
<entry>
<title>tree: pool the entry memory allocations</title>
<updated>2015-11-28T18:21:51+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2015-11-14T22:50:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=ed970748b600313306657de6e5447e5447790766'/>
<id>ed970748b600313306657de6e5447e5447790766</id>
<content type='text'>
These are rather small allocations, so we end up spending a non-trivial
amount of time asking the OS for memory. Since these entries are tied to
the lifetime of their tree, we can give the tree a pool so we speed up
the allocations.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These are rather small allocations, so we end up spending a non-trivial
amount of time asking the OS for memory. Since these entries are tied to
the lifetime of their tree, we can give the tree a pool so we speed up
the allocations.
</pre>
</div>
</content>
</entry>
<entry>
<title>treebuilder: take a repository for path validation</title>
<updated>2014-12-17T18:05:27+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@microsoft.com</email>
</author>
<published>2014-12-17T01:24:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=dce7b1a4e75551804a33591744d40d0582c57cfb'/>
<id>dce7b1a4e75551804a33591744d40d0582c57cfb</id>
<content type='text'>
Path validation may be influenced by `core.protectHFS` and
`core.protectNTFS` configuration settings, thus treebuilders
can take a repository to influence their configuration.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Path validation may be influenced by `core.protectHFS` and
`core.protectNTFS` configuration settings, thus treebuilders
can take a repository to influence their configuration.
</pre>
</div>
</content>
</entry>
<entry>
<title>treentry: no need for manual size book-keeping</title>
<updated>2014-06-10T13:14:13+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2014-06-09T20:59:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=fcc60066073b746332eb859c7fccdcece150bfcc'/>
<id>fcc60066073b746332eb859c7fccdcece150bfcc</id>
<content type='text'>
We can simply ask the hasmap.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We can simply ask the hasmap.
</pre>
</div>
</content>
</entry>
<entry>
<title>treebuilder: don't keep removed entries around</title>
<updated>2014-06-10T13:14:13+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2014-06-09T20:45:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=978fbb4c345e944004e5a2aede17cdd17ab75356'/>
<id>978fbb4c345e944004e5a2aede17cdd17ab75356</id>
<content type='text'>
If the user wants to keep a copy for themselves, they should make a
copy. It adds unnecessary complexity to make sure the returned entries
are valid until the builder is cleared.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the user wants to keep a copy for themselves, they should make a
copy. It adds unnecessary complexity to make sure the returned entries
are valid until the builder is cleared.
</pre>
</div>
</content>
</entry>
<entry>
<title>treebuilder: use a map instead of vector to store the entries</title>
<updated>2014-06-10T13:14:13+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2014-06-09T02:38:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=4d3f1f97404b01cd00ad5b2f47f64672d787e901'/>
<id>4d3f1f97404b01cd00ad5b2f47f64672d787e901</id>
<content type='text'>
Finding a filename in a vector means we need to resort it every time we
want to read from it, which includes every time we want to write to it
as well, as we want to find duplicate keys.

A hash-map fits what we want to do much more accurately, as we do not
care about sorting, but just the particular filename.

We still keep removed entries around, as the interface let you assume
they were going to be around until the treebuilder is cleared or freed,
but in this case that involves an append to a vector in the filter case,
which can now fail.

The only time we care about sorting is when we write out the tree, so
let's make that the only time we do any sorting.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Finding a filename in a vector means we need to resort it every time we
want to read from it, which includes every time we want to write to it
as well, as we want to find duplicate keys.

A hash-map fits what we want to do much more accurately, as we do not
care about sorting, but just the particular filename.

We still keep removed entries around, as the interface let you assume
they were going to be around until the treebuilder is cleared or freed,
but in this case that involves an append to a vector in the filter case,
which can now fail.

The only time we care about sorting is when we write out the tree, so
let's make that the only time we do any sorting.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add cat-file example and increase const use in API</title>
<updated>2013-05-16T17:38:27+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-05-16T17:38:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=58206c9ae79af8ef675e30087e5430065b078bbb'/>
<id>58206c9ae79af8ef675e30087e5430065b078bbb</id>
<content type='text'>
This adds an example implementation that emulates git cat-file.
It is a convenient and relatively simple example of getting data
out of a repository.

Implementing this also revealed that there are a number of APIs
that are still not using const pointers to objects that really
ought to be.  The main cause of this is that `git_vector_bsearch`
may need to call `git_vector_sort` before doing the search, so a
const pointer to the vector is not allowed.  However, for tree
objects, with a little care, we can ensure that the vector of
tree entries is always sorted and allow lookups to take a const
pointer.  Also, the missing const in commit objects just looks
like an oversight.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds an example implementation that emulates git cat-file.
It is a convenient and relatively simple example of getting data
out of a repository.

Implementing this also revealed that there are a number of APIs
that are still not using const pointers to objects that really
ought to be.  The main cause of this is that `git_vector_bsearch`
may need to call `git_vector_sort` before doing the search, so a
const pointer to the vector is not allowed.  However, for tree
objects, with a little care, we can ensure that the vector of
tree entries is always sorted and allow lookups to take a const
pointer.  Also, the missing const in commit objects just looks
like an oversight.
</pre>
</div>
</content>
</entry>
</feed>
