diff mbox series

[b4,1/2] prep: Fix splat with --auto-to-cc when a branch has no commits

Message ID 20230110-prep-opts-v1-1-8e7d7b861849@kernel.org (mailing list archive)
State Accepted
Headers show
Series A prep splat fix and rework of option handling | expand

Commit Message

Rob Herring Jan. 10, 2023, 9:46 p.m. UTC
Running 'b4 prep -c' on a branch with no commits will splat. Print a
friendly message instead.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 b4/ez.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/b4/ez.py b/b4/ez.py
index 36f935ebe993..1b7e390b7744 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1819,7 +1819,12 @@  def auto_to_cc() -> None:
             logger.debug('added %s to seen', ltr.addr[1])
             extras.append(ltr)
 
-    tos, ccs, tag_msg, patches = get_prep_branch_as_patches()
+    try:
+        tos, ccs, tag_msg, patches = get_prep_branch_as_patches()
+    except RuntimeError:
+        logger.info('No commits in branch')
+        return
+
     logger.info('Collecting To/Cc addresses')
     # Go through the messages to make to/cc headers
     for commit, msg in patches: