diff mbox series

ez: Fix 'trailers -F' used on a single commit

Message ID 20230330201529.2744290-1-robh@kernel.org (mailing list archive)
State Accepted
Headers show
Series ez: Fix 'trailers -F' used on a single commit | expand

Commit Message

Rob Herring March 30, 2023, 8:15 p.m. UTC
Running 'b4 trailers -u -F <msgid>' on a single commit fails:

CRITICAL: Failed to convert range to patches: Could not run rev-list None~1..409ee53c38a1d9a60e76ffa92088cfad07cea850

The problem is the loop is exited after 1 iteration and prevcommit is never
set.

Signed-off-by: Rob Herring <robh@kernel.org>
---
I think a base commit option and/or use upstream tracking branch is needed
here. There's probably cases where one wants to apply trailers and they
are not the author.
---
 b4/ez.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Konstantin Ryabitsev May 26, 2023, 6:23 p.m. UTC | #1
On Thu, 30 Mar 2023 15:15:29 -0500, Rob Herring wrote:
> Running 'b4 trailers -u -F <msgid>' on a single commit fails:
> 
> CRITICAL: Failed to convert range to patches: Could not run rev-list None~1..409ee53c38a1d9a60e76ffa92088cfad07cea850
> 
> The problem is the loop is exited after 1 iteration and prevcommit is never
> set.
> 
> [...]

Applied, thanks!

[1/1] ez: Fix 'trailers -F' used on a single commit
      commit: 3151f4267ec4c711db47c14c3460e36b8d3d05b3

Best regards,
diff mbox series

Patch

diff --git a/b4/ez.py b/b4/ez.py
index cf8759015f29..1a9abd642623 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -834,6 +834,8 @@  def update_trailers(cmdargs: argparse.Namespace) -> None:
                 break
             prevparent = parent
             prevcommit = commit
+        if prevcommit is None:
+            prevcommit = end
         start = f'{prevcommit}~1'
     else:
         logger.critical('CRITICAL: Please specify -F msgid to look up trailers from remote.')