diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-04-15 13:43:17 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-04-15 13:43:17 -0400 |
commit | 7a1a978790036f35b8d3d83b80105be1ca15ccd6 (patch) | |
tree | 4a354773c70bcc594c2e222ab4e5481f89faabd1 | |
parent | c879aadb217582cba1b38af76a0389c64401d8d6 (diff) | |
download | b4-7a1a978790036f35b8d3d83b80105be1ca15ccd6.tar.gz |
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 <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
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 |