diff mbox series

Fall back to EMAIL environment email

Message ID 20230317102107.17422-1-hi@alyssa.is (mailing list archive)
State Accepted
Headers show
Series Fall back to EMAIL environment email | expand

Commit Message

Alyssa Ross March 17, 2023, 10:21 a.m. UTC
This matches git's behavior.  Without this change, b4 shazam would
catch the KeyError and exit 1 with no error message.  This will still
happen if EMAIL is also unset.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 b4/__init__.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Konstantin Ryabitsev March 17, 2023, 1:58 p.m. UTC | #1
On Fri, 17 Mar 2023 10:21:07 +0000, Alyssa Ross wrote:
> This matches git's behavior.  Without this change, b4 shazam would
> catch the KeyError and exit 1 with no error message.  This will still
> happen if EMAIL is also unset.
> 
> 

Applied, thanks!

[1/1] Fall back to EMAIL environment email
      commit: 20972c58601f9a6ff4440e23be8d6261c6bc5b93

Best regards,
diff mbox series

Patch

diff --git a/b4/__init__.py b/b4/__init__.py
index 94c1693..31d7672 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -2579,6 +2579,8 @@  def get_user_config():
         if 'name' not in USER_CONFIG:
             udata = pwd.getpwuid(os.getuid())
             USER_CONFIG['name'] = udata.pw_gecos
+        if 'email' not in USER_CONFIG:
+            USER_CONFIG['email'] = os.environ['EMAIL']
     return USER_CONFIG