Skip to content

Commit

Permalink
service: dev: Ignore issues loading ~/.gitconfig
Browse files Browse the repository at this point in the history
Fixes: #1236
Signed-off-by: John Andersen <john.s.andersen@intel.com>
  • Loading branch information
pdxjohnny committed Jan 4, 2022
1 parent 669ac3d commit 5c4f2fe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dffml/service/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@
)

config = configparser.ConfigParser()
config.read(Path("~", ".gitconfig").expanduser())
with contextlib.suppress(Exception):
config.read(Path("~", ".gitconfig").expanduser())

USER = "unknown"
with contextlib.suppress(KeyError):
USER = getpass.getuser()

NAME = config.get("user", "name", fallback="Unknown")
EMAIL = config.get("user", "email", fallback="unknown@example.com")
NAME = "Unknown"
with contextlib.suppress(Exception):
NAME = config.get("user", "name", fallback="Unknown")

EMAIL = "unknown@example.com"
with contextlib.suppress(Exception):
EMAIL = config.get("user", "email", fallback="unknown@example.com")

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

Expand Down

0 comments on commit 5c4f2fe

Please sign in to comment.