git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 17:58 UTC

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

From
YGYee Cheng Chin via GitGitGadget <gitgitgadget@gmail.com>
Date
Dec 23, 2025, 04:41 UTC
Message-ID
<pull.2139.git.git.1766464905719.gitgitgadget@gmail.com>
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
Message 1 of 1 in “xdiff: fix outdated xpatience comments referring to "ha" member var”
  1. xdiff: fix outdated xpatience comments referring to "ha" member varYee Cheng Chin via GitGitGadget, Dec 23, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.