All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: tools@kernel.org
Cc: Will Deacon <will@kernel.org>,
	Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Nicolin Chen <nicolinc@nvidia.com>
Subject: [PATCH v2 1/2] ty: Try subject matching for every commit before using trackers
Date: Mon,  4 Mar 2024 13:42:40 +0000	[thread overview]
Message-ID: <20240304134241.20447-2-will@kernel.org> (raw)
In-Reply-To: <20240304134241.20447-1-will@kernel.org>

Nicolin reports that 'b4 ty' produced a "thank you" letter with
incorrect commit IDs:

  https://lore.kernel.org/r/ZeDtfKMUXnOnJOic@Asurada-Nvidia

This appears to be because of the creative use of Message-Ids in the
series at:

  https://lore.kernel.org/r/0-v6-96275f25c39d+2d4-smmuv3_newapi_p1_jgg@nvidia.com

For example, comparing the Message-Id of patches 1 and 11 of that series,
we can see that one is a substring of the other:

  Message-Id: <1-v6-96275f25c39d+2d4-smmuv3_newapi_p1_jgg@nvidia.com>
  Message-Id: <11-v6-96275f25c39d+2d4-smmuv3_newapi_p1_jgg@nvidia.com>

This confuses auto_locate_series(), as it will end up matching the
Message-Id of patch 1 with the Link: tag in patch 11 and therefore get
the wrong patch/commit association.

Fix this problem by trying to match each commit based on the Subject
before falling back to the fuzzier tracker-based matching.

Reported-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Will Deacon <will@kernel.org>
---
 src/b4/ty.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/b4/ty.py b/src/b4/ty.py
index a8bdabf5bcbc..950c357a89c5 100644
--- a/src/b4/ty.py
+++ b/src/b4/ty.py
@@ -217,7 +217,13 @@ def auto_locate_series(gitdir: Optional[str], jsondata: dict, branch: str,
                     success = True
                     matches += 1
                     break
-                elif len(patch) > 2 and len(patch[2]) and len(commit[2]):
+
+            if success:
+                continue
+
+            # try to locate by tracker
+            for pwhash, commit in commits.items():
+                if len(patch) > 2 and len(patch[2]) and len(commit[2]):
                     for tracker in commit[2]:
                         if tracker.find(patch[2]) >= 0:
                             logger.debug('Matched using recorded message-id')
-- 
2.44.0.rc1.240.g4c46232300-goog


  reply	other threads:[~2024-03-04 13:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 13:42 [PATCH v2 0/2] b4: ty: Fix incorrect patch/commit association Will Deacon
2024-03-04 13:42 ` Will Deacon [this message]
2024-03-04 13:42 ` [PATCH v2 2/2] ty: Remove unused 'matches' variable Will Deacon
2024-03-04 21:32 ` [PATCH v2 0/2] b4: ty: Fix incorrect patch/commit association Konstantin Ryabitsev
2024-05-01 21:23 ` Konstantin Ryabitsev
2024-05-02  9:23   ` Will Deacon
2024-05-02 18:31     ` Konstantin Ryabitsev

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=20240304134241.20447-2-will@kernel.org \
    --to=will@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=nicolinc@nvidia.com \
    --cc=tools@kernel.org \
    /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 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.