tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: tools@linux.kernel.org
Cc: Konstantin Ryabitsev <mricon@kernel.org>
Subject: [PATCH b4] Handle author A, submitter B, committer A SOB chain correctly
Date: Mon, 03 Mar 2025 17:20:57 +0100	[thread overview]
Message-ID: <875xkqccgm.ffs@tglx> (raw)

The trailer handling of b4 fails to handle one particular case
correctly:

Dev A posts a patch with his SOB

        Subject: [PATCH] subsys: Something
        From: Dev A <deva@k.org>

          Some explanation

          Signed-off-by: Dev A <deva@k.org>

Dev B picks the patch up, adds his SOB and reposts it in a follow up
series:

        Subject: [PATCH v2 1/5] subsys: Something
        From: Dev B <devb@k.org>

          From: Dev A <deva@k.org>
          
          Some explanation

          Signed-off-by: Dev A <deva@k.org>
          Signed-off-by: Dev B <devb@k.org>

Now Dev A who is also the maintainer picks the series up and b4 converts
it to:

        Author: Dev A <deva@k.org>

          subsys: Something

          Some explanation

          Signed-off-by: Dev B <devb@k.org>
          Signed-off-by: Dev A <deva@k.org>

While Dev A is correctly assigned to be the author of the commit, the
SOB chain is incorrect because the first SOB is not the author's
SOB. The correct resolution for this is:

        Author: Dev A <deva@k.org>

          subsys: Something

          Some explanation

          Signed-off-by: Dev A <deva@k.org>
          Signed-off-by: Dev B <devb@k.org>
          Signed-off-by: Dev A <deva@k.org>

Validate that the committers SOB is the last one in the SOB chain and
only remove it from processing if that's true. If the committers SOB is
before the last SOB in the submission, then keep the ordering intact and
add an extra committer SOB at the end.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 src/b4/__init__.py |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

--- a/src/b4/__init__.py
+++ b/src/b4/__init__.py
@@ -2205,9 +2205,22 @@ MAILMAP_INFO = dict()
         sobtr = LoreTrailer()
         hasmysob = False
         if sobtr in btrailers:
+
+            found = False
+            last = True
+            for bltr in btrailers:
+                if not found:
+                    found = bltr == sobtr
+                else:
+                    if bltr.lname == 'signed-off-by':
+                        last = False
+                        break
+
             # Our own signoff always moves to the bottom of all trailers
-            hasmysob = True
-            btrailers.remove(sobtr)
+            # if it is the last signoff in the chain.
+            if last:
+                hasmysob = True
+                btrailers.remove(sobtr)
 
         new_trailers = self.followup_trailers
         if extras:

                 reply	other threads:[~2025-03-03 16:21 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=875xkqccgm.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=mricon@kernel.org \
    --cc=tools@linux.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 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).