From bd64dab483f6302bbdd792c5e678c0ab51060cbe Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Wed, 29 Sep 2021 16:11:21 -0400 Subject: shazam: allow configuring "git am" flags Setting b4.git-am-flags should allow you to specify what additional flags to pass to "git am" before shazaming a bunch of patches on to the current branch. Example entry in ~/.gitconfig [b4] git-am-flags = -s Signed-off-by: Konstantin Ryabitsev --- b4/mbox.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/b4/mbox.py b/b4/mbox.py index dc4cebb..5706a91 100644 --- a/b4/mbox.py +++ b/b4/mbox.py @@ -19,6 +19,7 @@ import shutil import pathlib import tempfile import io +import shlex import urllib.parse import xml.etree.ElementTree @@ -252,8 +253,11 @@ def make_am(msgs, cmdargs, msgid): b4.save_git_am_mbox(am_msgs, ifh) ambytes = ifh.getvalue().encode() if cmdargs.applyhere: - # Blindly attempt to apply to the current tree - ecode, out = b4.git_run_command(topdir, ['am'], stdin=ambytes, logstderr=True) + amflags = config.get('git-am-flags', '') + sp = shlex.shlex(amflags, posix=True) + sp.whitespace_split = True + amargs = list(sp) + ecode, out = b4.git_run_command(topdir, ['am'] + amargs, stdin=ambytes, logstderr=True) logger.info(out.strip()) if ecode == 0: thanks_record_am(lser, cherrypick=cherrypick) -- cgit v1.2.3