diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2021-08-03 16:19:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-03 16:19:51 +0100 |
commit | 39f12bd49a49b96d435c0ab7915bde6011d34f0f (patch) | |
tree | d46729db379520bb74876af407ad1a66edcb908e /git/util.py | |
parent | d8a639865d02a6bb3f93a233d3caa928d18bc622 (diff) | |
download | gitpython-39f12bd49a49b96d435c0ab7915bde6011d34f0f.tar.gz |
Do not call get_user_id if it is not needed
On systems without any environment variables and no pwd module, gitpython crashes as it tries to read the environment variable before looking at its config.
Diffstat (limited to 'git/util.py')
-rw-r--r-- | git/util.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/git/util.py b/git/util.py index 92d95379..84d0b015 100644 --- a/git/util.py +++ b/git/util.py @@ -704,7 +704,11 @@ class Actor(object): setattr(actor, attr, val) except KeyError: if config_reader is not None: - setattr(actor, attr, config_reader.get_value('user', cvar, default())) + try: + val = config_reader.get_value('user', cvar) + except Exception: + val = default() + setattr(actor, attr, val) # END config-reader handling if not getattr(actor, attr): setattr(actor, attr, default()) |