<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/reftable/record.c, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-04-29T21:21:30Z</updated>
<entry>
<title>Merge branch 'ps/reftable-api-revamp'</title>
<updated>2025-04-29T21:21:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-04-29T21:21:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a819a3da85655031a23abae0f75d0910697fb92c'/>
<id>urn:sha1:a819a3da85655031a23abae0f75d0910697fb92c</id>
<content type='text'>
Overhaul of the reftable API.

* ps/reftable-api-revamp:
  reftable/table: move printing logic into test helper
  reftable/constants: make block types part of the public interface
  reftable/table: introduce iterator for table blocks
  reftable/table: add `reftable_table` to the public interface
  reftable/block: expose a generic iterator over reftable records
  reftable/block: make block iterators reseekable
  reftable/block: store block pointer in the block iterator
  reftable/block: create public interface for reading blocks
  git-zlib: use `struct z_stream_s` instead of typedef
  reftable/block: rename `block_reader` to `reftable_block`
  reftable/block: rename `block` to `block_data`
  reftable/table: move reading block into block reader
  reftable/block: simplify how we track restart points
  reftable/blocksource: consolidate code into a single file
  reftable/reader: rename data structure to "table"
  reftable: fix formatting of the license header
</content>
</entry>
<entry>
<title>Merge branch 'ps/reftable-sans-compat-util'</title>
<updated>2025-04-08T18:43:14Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-04-08T18:43:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6e2a3b8ae0e07c0c31f2247fec49b77b5d903a83'/>
<id>urn:sha1:6e2a3b8ae0e07c0c31f2247fec49b77b5d903a83</id>
<content type='text'>
Make the code in reftable library less reliant on the service
routines it used to borrow from Git proper, to make it easier to
use by external users of the library.

* ps/reftable-sans-compat-util:
  Makefile: skip reftable library for Coccinelle
  reftable: decouple from Git codebase by pulling in "compat/posix.h"
  git-compat-util.h: split out POSIX-emulating bits
  compat/mingw: split out POSIX-related bits
  reftable/basics: introduce `REFTABLE_UNUSED` annotation
  reftable/basics: stop using `SWAP()` macro
  reftable/stack: stop using `sleep_millisec()`
  reftable/system: introduce `reftable_rand()`
  reftable/reader: stop using `ARRAY_SIZE()` macro
  reftable/basics: provide wrappers for big endian conversion
  reftable/basics: stop using `st_mult()` in array allocators
  reftable: stop using `BUG()` in trivial cases
  reftable/record: don't `BUG()` in `reftable_record_cmp()`
  reftable/record: stop using `BUG()` in `reftable_record_init()`
  reftable/record: stop using `COPY_ARRAY()`
  reftable/blocksource: stop using `xmmap()`
  reftable/stack: stop using `write_in_full()`
  reftable/stack: stop using `read_in_full()`
</content>
</entry>
<entry>
<title>reftable/constants: make block types part of the public interface</title>
<updated>2025-04-07T21:53:12Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-04-07T13:16:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0f8ee94b636b5ab183c62b8fdd26c1611c2b86f4'/>
<id>urn:sha1:0f8ee94b636b5ab183c62b8fdd26c1611c2b86f4</id>
<content type='text'>
Now that reftable blocks can be read individually via the public
interface it becomes necessary for callers to be able to distinguish the
different types of blocks. Expose the relevant constants.

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>reftable: fix formatting of the license header</title>
<updated>2025-04-07T21:53:09Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-04-07T13:16:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6dcc05ffc3ead0745d19decd0e8ecd65edc9d414'/>
<id>urn:sha1:6dcc05ffc3ead0745d19decd0e8ecd65edc9d414</id>
<content type='text'>
The license headers used across the reftable library doesn't follow our
typical coding style for multi-line comments. Fix it.

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>reftable: propagate specific error codes in block_writer_add()</title>
<updated>2025-03-21T08:51:07Z</updated>
<author>
<name>Meet Soni</name>
<email>meetsoni3017@gmail.com</email>
</author>
<published>2025-03-19T15:29:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=27571684ddca217d65c5f39947f20b9f5ec91863'/>
<id>urn:sha1:27571684ddca217d65c5f39947f20b9f5ec91863</id>
<content type='text'>
Previously, functions block_writer_add() and related functions returned
-1 when the record did not fit, forcing the caller to assume that any
failure meant the entry was too big. Replace these generic -1 returns
with defined error codes.

This prepares the codebase for finer-grained error handling so that
callers can distinguish between a block-full condition and other errors.

Signed-off-by: Meet Soni &lt;meetsoni3017@gmail.com&gt;
Acked-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>reftable/basics: introduce `REFTABLE_UNUSED` annotation</title>
<updated>2025-02-18T18:55:38Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-02-18T09:20:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f93b2a04243ee1a95920ae02a9423accbe1c3719'/>
<id>urn:sha1:f93b2a04243ee1a95920ae02a9423accbe1c3719</id>
<content type='text'>
Introduce the `REFTABLE_UNUSED` annotation and replace all existing
users of `UNUSED` in the reftable library to use the new macro instead.

Note that we unconditionally define `MAYBE_UNUSED` in the exact same
way, so doing so unconditionally for `REFTABLE_UNUSED` should be fine,
too.

Suggested-by: Toon Claes &lt;toon@iotcl.com&gt;
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>reftable/basics: stop using `SWAP()` macro</title>
<updated>2025-02-18T18:55:38Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-02-18T09:20:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f8ed12dec459df9ea0d43ccacc93cb2c32702c0e'/>
<id>urn:sha1:f8ed12dec459df9ea0d43ccacc93cb2c32702c0e</id>
<content type='text'>
Stop using `SWAP()` macro in favor of an open-coded variant of it. Note
that this also requires us to open-code the build assert that `SWAP()`
itself uses to verify that the size of both variables matches.

This is done to reduce our dependency on the Git codebase.

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>reftable/basics: provide wrappers for big endian conversion</title>
<updated>2025-02-18T18:55:37Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-02-18T09:20:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e676694298c4a8d9f6fdf3844cbfb03bbee552cc'/>
<id>urn:sha1:e676694298c4a8d9f6fdf3844cbfb03bbee552cc</id>
<content type='text'>
We're using a mixture of big endian conversion functions provided by
both the reftable library, but also by the Git codebase. Refactor the
code so that we exclusively use reftable-provided wrappers in order to
untangle us from the Git codebase.

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>reftable/record: don't `BUG()` in `reftable_record_cmp()`</title>
<updated>2025-02-18T18:55:36Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-02-18T09:20:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6f6127decde6785b9ba5f22a07a7754d1fda1a59'/>
<id>urn:sha1:6f6127decde6785b9ba5f22a07a7754d1fda1a59</id>
<content type='text'>
The reftable library aborts with a bug in case `reftable_record_cmp()`
is invoked with two records of differing types. This would cause the
program to die without the caller being able to handle the error, which
is not something we want in the context of library code. And it ties us
to the Git codebase.

Refactor the code such that `reftable_record_cmp()` returns an error
code separate from the actual comparison result. This requires us to
also adapt some callers up the callchain in a similar fashion.

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>reftable/record: stop using `BUG()` in `reftable_record_init()`</title>
<updated>2025-02-18T18:55:36Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-02-18T09:20:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9d9fac0f34ec47cc6eafeb3e10378ab8f3310346'/>
<id>urn:sha1:9d9fac0f34ec47cc6eafeb3e10378ab8f3310346</id>
<content type='text'>
We're aborting the program via `BUG()` in case `reftable_record_init()`
was invoked with an unknown record type. This is bad because we may now
die in library code, and because it makes us depend on the Git codebase.

Refactor the code such that `reftable_record_init()` can return an error
code to the caller. Adapt any callers accordingly.

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