From: Gustav Hållberg Date: Sun, 21 Dec 2008 10:55:52 +0000 (+0100) Subject: stg mail: Improve error message for unknown sender identity X-Git-Tag: v0.15-rc1~73 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/ea09f8ce7b1bcea38a7d9f0079a28c6109989342?ds=sidebyside stg mail: Improve error message for unknown sender identity Signed-off-by: Gustav Hållberg Signed-off-by: Karl Hasselström --- diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py index 2dd88c3..cab896b 100644 --- a/stgit/commands/mail.py +++ b/stgit/commands/mail.py @@ -154,9 +154,14 @@ def __get_sender(): try: sender = str(git.user()) except git.GitException: - sender = str(git.author()) + try: + sender = str(git.author()) + except git.GitException: + pass if not sender: - raise CmdException, 'unknown sender details' + raise CmdException, ('Unknown sender name and e-mail; you should' + ' for example set git config user.name and' + ' user.email') sender = email.Utils.parseaddr(sender) return email.Utils.formataddr(address_or_alias(sender)) @@ -551,6 +556,9 @@ def func(parser, options, args): else: raise CmdException, 'Incorrect options. Unknown patches to send' + # early test for sender identity + __get_sender() + out.start('Checking the validity of the patches') for p in patches: if crt_series.empty_patch(p):