All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xdiff: fix outdated xpatience comments referring to "ha" member var
@ 2025-12-23  4:41 Yee Cheng Chin via GitGitGadget
  0 siblings, 0 replies; only message in thread
From: Yee Cheng Chin via GitGitGadget @ 2025-12-23  4:41 UTC (permalink / raw)
  To: git; +Cc: Ezekiel Newren, Yee Cheng Chin, Yee Cheng Chin

From: Yee Cheng Chin <ychin.git@gmail.com>

The `ha` member variable was refactored to separate `line_hash` and
`minimal_perfect_hash` ones in 6a26019c81f. However, there is a
stale comment in xpatience.c that still refers to it. Fix the comment to
make sure it is consistent with code.

Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
---
    xdiff: Fix outdated comments referring to "ha" member var

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2139%2Fychin%2Ffix-patience-diff-wrong-ha-docs-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2139/ychin/fix-patience-diff-wrong-ha-docs-v1
Pull-Request: https://github.com/git/git/pull/2139

 xdiff/xpatience.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/xdiff/xpatience.c b/xdiff/xpatience.c
index 9580d18032..ec65932e21 100644
--- a/xdiff/xpatience.c
+++ b/xdiff/xpatience.c
@@ -92,14 +92,13 @@ static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map,
 		map->env->xdf1.recs : map->env->xdf2.recs;
 	xrecord_t *record = &records[line - 1];
 	/*
-	 * After xdl_prepare_env() (or more precisely, due to
-	 * xdl_classify_record()), the "ha" member of the records (AKA lines)
-	 * is _not_ the hash anymore, but a linearized version of it.  In
-	 * other words, the "ha" member is guaranteed to start with 0 and
-	 * the second record's ha can only be 0 or 1, etc.
+	 * The "minimal_perfect_hash" member of the records (AKA lines) is a
+	 * linearized version of the hash.  In other words, it is guaranteed to
+	 * start with 0 and the second record's minimal_perfect_hash can only
+	 * be 0 or 1, etc.
 	 *
-	 * So we multiply ha by 2 in the hope that the hashing was
-	 * "unique enough".
+	 * So we multiply minimal_perfect_hash by 2 in the hope that the
+	 * hashing was "unique enough".
 	 */
 	int index = (int)((record->minimal_perfect_hash << 1) % map->alloc);
 

base-commit: c8d76f7325e75c6f0549fce29ea4f3d97eb079cb
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-23  4:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-23  4:41 [PATCH] xdiff: fix outdated xpatience comments referring to "ha" member var Yee Cheng Chin via GitGitGadget

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.