diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-11-18 16:33:55 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-11-19 12:23:09 +0900 |
commit | 88e297275b94f2fbbc60b770f37654796799b907 (patch) | |
tree | 66e5ab299f93ebda39bff909eb6a50976cc3fb0d /t/unit-tests/t-basic.c | |
parent | 17e80398782b4e8746a389604aaaf9744fd6900a (diff) |
reftable: explicitly handle hash format IDs
The hash format IDs are used for two different things across the
reftable codebase:
- They are used as a 32 bit unsigned integer when reading and writing
the header in order to identify the hash function.
- They are used internally to identify which hash function is in use.
When one only considers the second usecase one might think that one can
easily change the representation of those hash IDs. But because those
IDs end up in the reftable header and footer on disk it is important
that those never change.
Create separate constants `REFTABLE_FORMAT_ID_*` and use them in
contexts where we read or write reftable headers. This serves multiple
purposes:
- It allows us to more easily discern cases where we actually use
those constants for the on-disk format.
- It detangles us from the same constants that are defined in
libgit.a, which is another required step to convert the reftable
library to become standalone.
- It makes the next step easier where we stop using `GIT_*_FORMAT_ID`
constants in favor of a custom enum.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests/t-basic.c')
0 files changed, 0 insertions, 0 deletions