From 7a1a978790036f35b8d3d83b80105be1ca15ccd6 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Wed, 15 Apr 2020 13:43:17 -0400 Subject: Get info from gecos if we don't have user.name Git gets user.name from gecos if it's not specified in user.name, so let's do the same thing. Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'b4/__init__.py') diff --git a/b4/__init__.py b/b4/__init__.py index 626042a..e511f51 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -18,6 +18,7 @@ import datetime import time import shutil import mailbox +import pwd from pathlib import Path from tempfile import mkstemp @@ -1548,6 +1549,9 @@ def get_user_config(): global USER_CONFIG if USER_CONFIG is None: USER_CONFIG = get_config_from_git(r'user\..*') + if 'name' not in USER_CONFIG: + udata = pwd.getpwuid(os.getuid()) + USER_CONFIG['name'] = udata.pw_gecos return USER_CONFIG -- cgit v1.2.3