]> Kevux Git Server - rit/commit
patch-ids: document intentional const-casting in patch_id_neq()
authorTian Yuchen <cat@malon.dev>
Mon, 9 Mar 2026 06:51:40 +0000 (14:51 +0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Mar 2026 19:45:19 +0000 (12:45 -0700)
commit4c223571bef1c008c11ad5028072af862d3e7fe3
treec02ecea7100fc75a95847a400038d56fc0621c0f
parent9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed
patch-ids: document intentional const-casting in patch_id_neq()

The hashmap API requires the comparison function to take const pointers.
However, patch_id_neq() uses lazy evaluation to compute patch IDs on
demand. As established in b3dfeebb (rebase: avoid computing unnecessary
patch IDs, 2016-07-29), this avoids unnecessary work since not all
objects in the hashmap will eventually be compared.

Remove the ten-year-old "NEEDSWORK" comment and formally document
this intentional design trade-off.

Signed-off-by: Tian Yuchen <cat@malon.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
patch-ids.c