diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-03-16 10:48:15 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-16 10:48:15 -0700 |
| commit | 9883fcb960614aa2d360a3b292e21aee10baeb50 (patch) | |
| tree | f3435096a7ed341f4161b666fe6686f25a19ae8a /patch-ids.c | |
| parent | 3c59f3bc4b7f2a972a2ec5690af4897d5a87a586 (diff) | |
| parent | 4c223571bef1c008c11ad5028072af862d3e7fe3 (diff) | |
| download | git-9883fcb960614aa2d360a3b292e21aee10baeb50.tar.xz | |
Merge branch 'ty/patch-ids-document-lazy-eval'
In-code comment update to record a design decision to allow lazy
computation of patch IDs.
* ty/patch-ids-document-lazy-eval:
patch-ids: document intentional const-casting in patch_id_neq()
Diffstat (limited to 'patch-ids.c')
| -rw-r--r-- | patch-ids.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/patch-ids.c b/patch-ids.c index a5683b462c..1fbc88cbec 100644 --- a/patch-ids.c +++ b/patch-ids.c @@ -41,7 +41,14 @@ static int patch_id_neq(const void *cmpfn_data, const struct hashmap_entry *entry_or_key, const void *keydata UNUSED) { - /* NEEDSWORK: const correctness? */ + /* + * We drop the 'const' modifier here intentionally. + * + * Even though eptr and entry_or_key are const, we want to + * lazily compute their .patch_id members; see b3dfeebb (rebase: + * avoid computing unnecessary patch IDs, 2016-07-29). So we cast + * the constness away with container_of(). + */ struct diff_options *opt = (void *)cmpfn_data; struct patch_id *a, *b; |
