Subject: [PATCH] xdiff: fix outdated xpatience comments referring to "ha" member var

From: "Yee Cheng Chin via GitGitGadget" <[email-masked]>
Date: Tue, 23 Dec 2025 04:41:45 +0000

From: Yee Cheng Chin <[email-masked]>

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 <[email-masked]>
---
    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