Files
git/tree-walk.c
Johannes Schindelin d592ee79da tree-walk: widen init_tree_desc() and init_tree_desc_gently() to size_t
Prep for dropping the cast_size_t_to_ulong() shim in
add_preferred_base() (pack-objects.c), and aligns the public API
with the size_t shape the rest of the tree topic is moving toward.

struct tree_desc.size stays unsigned int -- the on-disk tree format
hard-caps each tree at 4 GiB, so the field is intentionally narrow
and the assignment in init_tree_desc_internal() already truncated
unsigned long inputs the same way it now truncates size_t inputs.
The widening is purely about the call-side type-correctness; the
internal cap is unchanged.

All 30+ callers pass values that promote cleanly (unsigned long,
size_t, or smaller integer types).

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:44:10 +02:00

32 KiB