]> Kevux Git Server - rit/commit
object-name: move logic to compute loose abbreviation length
authorPatrick Steinhardt <ps@pks.im>
Fri, 20 Mar 2026 07:07:38 +0000 (08:07 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Mar 2026 20:16:42 +0000 (13:16 -0700)
commitab3ab1038dd38d2be62e3bacf39a3248929a7a98
tree569657bfdc996d2b84ab4e3e1bbf493b6590d692
parent1a2842d1b1e91d5e068d231cf4df4e783bdf9205
object-name: move logic to compute loose abbreviation length

The function `repo_find_unique_abbrev_r()` takes as input an object ID
as well as a minimum object ID length and returns the minimum required
prefix to make the object ID unique.

The logic that computes the abbreviation length for loose objects is
deeply tied to the loose object storage format. As such, it would fail
in case a different object storage format was used.

Prepare for making this logic generic to the backend by moving the logic
into a new `odb_source_loose_find_abbrev_len()` function that is part of
"object-file.c".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object-file.c
object-file.h
object-name.c