<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/cache-tree.h, branch main</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=main</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2026-03-03T23:09:36Z</updated>
<entry>
<title>cache-tree: allow writing in-memory index as tree</title>
<updated>2026-03-03T23:09:36Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-02T12:13:10Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=a021e4f92cbacdb028b3efa49f619b076e72c9a6'/>
<id>urn:sha1:a021e4f92cbacdb028b3efa49f619b076e72c9a6</id>
<content type='text'>
The function `write_in_core_index_as_tree()` takes a repository and
writes its index into a tree object. What this function cannot do though
is to take an _arbitrary_ in-memory index.

Introduce a new `struct index_state` parameter so that the caller can
pass a different index than the one belonging to the repository. This
will be used in a subsequent commit.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cache-tree: refactor verification to return error codes</title>
<updated>2024-10-07T22:08:11Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-10-07T04:38:15Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=9f119599a69eb11f0712cab3bdbc2000eb91abd7'/>
<id>urn:sha1:9f119599a69eb11f0712cab3bdbc2000eb91abd7</id>
<content type='text'>
The function `cache_tree_verify()` will `BUG()` whenever it finds that
the cache-tree extension of the index is corrupt. The function is thus
inherently untestable because the resulting call to `abort()` will be
detected by our testing framework and labelled an error. And rightfully
so: it shouldn't ever be possible to hit bugs, as they should indicate a
programming error rather than corruption of on-disk state.

Refactor the function to instead return error codes. This also ensures
that the function can be used e.g. by git-fsck(1) without the whole
process dying. Furthermore, this refactoring plugs some memory leaks
when returning early by creating a common exit path.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>object.h: stop depending on cache.h; make cache.h depend on object.h</title>
<updated>2023-02-24T01:25:29Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-02-24T00:09:30Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=a64215b6cd5e67939187475c5b248dc5d13e3d60'/>
<id>urn:sha1:a64215b6cd5e67939187475c5b248dc5d13e3d60</id>
<content type='text'>
Things should be able to depend on object.h without pulling in all of
cache.h.  Move an enum to allow this.

Note that a couple files previously depended on things brought in
through cache.h indirectly (revision.h -&gt; commit.h -&gt; object.h -&gt;
cache.h).  As such, this change requires making existing dependencies
more explicit in half a dozen files.  The inclusion of strbuf.h in
some headers if of particular note: these headers directly embedded a
strbuf in some new structs, meaning they should have been including
strbuf.h all along but were indirectly getting the necessary
definitions.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cache-tree API: remove redundant update_main_cache_tree()</title>
<updated>2023-02-10T19:38:14Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2023-02-10T10:28:38Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=fcb864bce70573380e6409c4ca25d1bdf16b0841'/>
<id>urn:sha1:fcb864bce70573380e6409c4ca25d1bdf16b0841</id>
<content type='text'>
Remove the redundant update_main_cache_tree() function, and make its
users use cache_tree_update() instead.

The behavior of populating the "the_index.cache_tree" if it wasn't
present already was needed when this function was introduced in [1],
but it hasn't been needed since [2]; The "cache_tree_update()" will
now lazy-allocate, so there's no need for the wrapper.

1. 996277c5206 (Refactor cache_tree_update idiom from commit,
   2011-12-06)
2. fb0882648e0 (cache-tree: clean up cache_tree_update(), 2021-01-23)

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cocci &amp; cache-tree.h: migrate "write_cache_as_tree" to "*_index_*"</title>
<updated>2023-02-10T19:37:49Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2023-02-10T10:28:37Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=99370863e20131627f0ea0481b7006d0d2125c93'/>
<id>urn:sha1:99370863e20131627f0ea0481b7006d0d2125c93</id>
<content type='text'>
Add a trivial rule for "write_cache_as_tree" to
"index-compatibility.cocci", and apply it. This was left out of the
rules added in 0e6550a2c63 (cocci: add a
index-compatibility.pending.cocci, 2022-11-19) because this
compatibility wrapper lived in "cache-tree.h", not "cache.h"

But it's like the other "USE_THE_INDEX_COMPATIBILITY_MACROS", so let's
migrate it too.

The replacement of "USE_THE_INDEX_COMPATIBILITY_MACROS" here with
"USE_THE_INDEX_VARIABLE" is a manual change on top, now that these
files only use "&amp;the_index", and don't need any compatibility
macros (or functions).

The wrapping of some argument lists is likewise manual, as coccinelle
would otherwise give us overly long argument lists.

The reason for putting the "O" in the cocci rule on the "-" and "+"
lines is because I couldn't get correct whitespacing otherwise,
i.e. I'd end up with "oid,&amp;the_index", not "oid, &amp;the_index".

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cache-tree: remove cache_tree_find_path()</title>
<updated>2022-06-16T18:59:56Z</updated>
<author>
<name>Derrick Stolee</name>
<email>derrickstolee@github.com</email>
</author>
<published>2022-06-16T13:13:50Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=86aa250aa871a4d8314f1f51ee007e93a9461e1e'/>
<id>urn:sha1:86aa250aa871a4d8314f1f51ee007e93a9461e1e</id>
<content type='text'>
This reverts 080ab56a46 (cache-tree: implement cache_tree_find_path(),
2022-05-23). The cache_tree_find_path() method was never actually called
in the topic that added it. I cannot find any reference to it in any of
my forks, so this appears to not be needed at the moment.

Signed-off-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cache-tree: implement cache_tree_find_path()</title>
<updated>2022-05-23T18:08:21Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2022-05-23T13:48:41Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=080ab56a46ad65068201a768a04464341117fe81'/>
<id>urn:sha1:080ab56a46ad65068201a768a04464341117fe81</id>
<content type='text'>
Given a 'struct cache_tree', it may be beneficial to navigate directly
to a node within that corresponds to a given path name. Create
cache_tree_find_path() for this function. It returns NULL when no such
path exists.

The implementation is adapted from do_invalidate_path() which does a
similar search but also modifies the nodes it finds along the way. The
method could be implemented simply using tail-recursion, but this while
loop does the same thing.

This new method is not currently used, but will be in an upcoming
change.

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cache-tree: extract subtree_pos()</title>
<updated>2021-01-24T01:14:07Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2021-01-23T19:58:13Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c80dd3967f28527dab49c8e9525524c7f33baa22'/>
<id>urn:sha1:c80dd3967f28527dab49c8e9525524c7f33baa22</id>
<content type='text'>
This method will be helpful to use outside of cache-tree.c in a later
feature. The implementation is subtle due to subtree_name_cmp() sorting
by length and then lexicographically.

Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cache-tree: share code between functions writing an index as a tree</title>
<updated>2019-08-19T17:08:03Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2019-08-17T18:41:32Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=724dd767b245db588840d7e9dbd46687ee84020b'/>
<id>urn:sha1:724dd767b245db588840d7e9dbd46687ee84020b</id>
<content type='text'>
write_tree_from_memory() appeared to be a merge-recursive special that
basically duplicated write_index_as_tree().  The two have a different
signature, but the bigger difference was just that write_index_as_tree()
would always unconditionally read the index off of disk instead of
working on the current in-memory index.  So:

  * split out common code into write_index_as_tree_internal()

  * rename write_tree_from_memory() to write_inmemory_index_as_tree(),
    make it call write_index_as_tree_internal(), and move it to
    cache-tree.c

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch</title>
<updated>2019-01-24T19:55:06Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2019-01-24T08:29:12Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=f8adbec9feaa7a1ab9814db1115826e87033712e'/>
<id>urn:sha1:f8adbec9feaa7a1ab9814db1115826e87033712e</id>
<content type='text'>
By default, index compat macros are off from now on, because they
could hide the_index dependency.

Only those in builtin can use it.

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>
</feed>
