aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-05-21 16:41:26 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-05-21 16:41:26 -0400
commitbdd1011f265b3c0da0ff32619c88998cbc4fb262 (patch)
treedae4f79583fe2aa679a63158e952be6b1b626dda
parentaf8a8bc01df2816fcc931e49c4d3911b51fd0f33 (diff)
downloadpatatt-bdd1011f265b3c0da0ff32619c88998cbc4fb262.tar.gz
Give a nicer error when user.email isn't set
It's unlikely that we're going to be used in a situation where user.email is not already set, but just in that case, make sure that we give a nicer-looking error. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--patatt/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/patatt/__init__.py b/patatt/__init__.py
index f15ccad..7226413 100644
--- a/patatt/__init__.py
+++ b/patatt/__init__.py
@@ -1014,7 +1014,10 @@ def cmd_genkey(cmdargs, config: dict) -> None:
# Do we have the signingkey defined?
usercfg = get_config_from_git(r'user\..*')
- if not config.get('identity') and usercfg.get('email'):
+ if not config.get('identity'):
+ if not usercfg.get('email'):
+ logger.critical('This operation requires user.email to be set')
+ sys.exit(1)
# Use user.email
config['identity'] = usercfg.get('email')