Message ID | 20220825182506.1449442-1-robh@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | send: Use only the default git 'sendemail' config when no identity is set | expand |
On Thu, Aug 25, 2022 at 01:25:06PM -0500, Rob Herring wrote: > With no git sendemail 'identity' set, b4 send picks up all the identities > and uses the wrong settings. > > Signed-off-by: Rob Herring <robh@kernel.org> > --- > This only partially fixes the sendemail handling. If an identity is set, > we need to merge the identity's section with the default section as an > identity may not contain a complete configuration. Thank you for the suggestion. I didn't end up using your patch, but I adapted it to implement the fall-through behaviour that is compliant with how git does it. Regards, Konstantin
diff --git a/b4/__init__.py b/b4/__init__.py index 4296b109d118..a8ddf8534eaf 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -2759,7 +2759,7 @@ def get_smtp(identity: Optional[str] = None, sconfig = get_config_from_git(rf'sendemail\.{identity}\..*') sectname = f'sendemail.{identity}' else: - sconfig = get_config_from_git(rf'sendemail\..*') + sconfig = get_config_from_git(rf'sendemail\.[^.]+$') sectname = 'sendemail' if not len(sconfig): raise smtplib.SMTPException('Unable to find %s settings in any applicable git config' % sectname)
With no git sendemail 'identity' set, b4 send picks up all the identities and uses the wrong settings. Signed-off-by: Rob Herring <robh@kernel.org> --- This only partially fixes the sendemail handling. If an identity is set, we need to merge the identity's section with the default section as an identity may not contain a complete configuration. --- b4/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)