Commit a24a41e (git-commit: only append a newline to -m mesg if
necessary, 2013-02-18) introduced a regression: when
--allow-empty-message is used and an empty message is explicitly
specified with -m "", git commit still launches $EDITOR unnecessarily.
The commit (correctly) fixes opt_parse_m() to not fill in two newlines
into the message buffer unconditionally.  The real problem is that
launching $EDITOR only depends on use_editor and whether message is
empty.  Fix the problem by setting use_editor to 0 when
--allow-empty-message is specified in the codepath where an explicit
string is passed via -m.

Reported-by: Mislav Marohnić <>
Signed-off-by: Ramkumar Ramachandra <>
 builtin/commit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/builtin/commit.c b/builtin/commit.c
index d2f30d9..1f5da9d 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -128,6 +128,8 @@ static int opt_parse_m(const struct option *opt, const char 
*arg, int unset)
                        strbuf_addch(buf, '\n');
                strbuf_addstr(buf, arg);
+               if (allow_empty_message)
+                       use_editor = 0;
        return 0;

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to