From bf52e18aad6e0e8effcadc6b90dfedf4d15b1859 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 25 May 2011 10:39:51 -0400 Subject: Raise UserError if summary is not given to `be commit`. If the user doesn't provide the summary on the command line, through stdin, or through editor_string, raise an error. This will generally happen with $ be commit (user doesn't enter any text in the editory) --- libbe/command/commit.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libbe/command/commit.py b/libbe/command/commit.py index 32ca3ef..8416107 100644 --- a/libbe/command/commit.py +++ b/libbe/command/commit.py @@ -84,6 +84,9 @@ class Commit (libbe.command.Command): body = libbe.util.encoding.get_file_contents( params['body'], decode=True) if summary == None: # use the first body line as the summary + if body == None: + raise libbe.command.UserError( + 'cannot commit without a summary') lines = body.splitlines() summary = lines[0] body = '\n'.join(lines[1:]).strip() + '\n' -- cgit