git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yee Cheng Chin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Ezekiel Newren <ezekielnewren@gmail.com>,
	Yee Cheng Chin <ychin.git@gmail.com>,
	Yee Cheng Chin <ychin.git@gmail.com>
Subject: [PATCH] xdiff: fix outdated xpatience comments referring to "ha" member var
Date: Tue, 23 Dec 2025 04:41:45 +0000	[thread overview]
Message-ID: <pull.2139.git.git.1766464905719.gitgitgadget@gmail.com> (raw)

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

                 reply	other threads:[~2025-12-23  4:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.2139.git.git.1766464905719.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=ezekielnewren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ychin.git@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).