Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit 95595a3

Browse files
John Andersenpdxjohnny
authored andcommitted
service: dev: Ignore issues loading ~/.gitconfig
Fixes: #1236 Signed-off-by: John Andersen <[email protected]>
1 parent dc0c266 commit 95595a3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

dffml/service/dev.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,20 @@
4747
)
4848

4949
config = configparser.ConfigParser()
50-
config.read(Path("~", ".gitconfig").expanduser())
50+
with contextlib.suppress(Exception):
51+
config.read(Path("~", ".gitconfig").expanduser())
5152

5253
USER = "unknown"
5354
with contextlib.suppress(KeyError):
5455
USER = getpass.getuser()
5556

56-
NAME = config.get("user", "name", fallback="Unknown")
57-
EMAIL = config.get("user", "email", fallback="[email protected]")
57+
NAME = "Unknown"
58+
with contextlib.suppress(Exception):
59+
NAME = config.get("user", "name", fallback="Unknown")
60+
61+
62+
with contextlib.suppress(Exception):
63+
EMAIL = config.get("user", "email", fallback="[email protected]")
5864

5965
REPO_ROOT = pathlib.Path(__file__).parents[2]
6066

0 commit comments

Comments
 (0)