Skip to contentSkip to conversation

send: Use only the default git 'sendemail' config when no identity is set

PATCH In review Rob Herring 2 participants 2 messages Aug 25, 2022 – Aug 29, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 send: Use only the default git 'sendemail' config when no identity is set

With no git sendemail 'identity' set, b4 send picks up all the identities and uses the wrong settings.

---
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(-)
b4/__init__.py +1 -1
index 4296b109d118..a8ddf8534eaf 100644
@@ -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)
Signature · 1 line
2.34.1
#1 lore raw
Quoted 8 lines · Rob Herring

With no git sendemail 'identity' set, b4 send picks up all the identities and uses the wrong settings.

---
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