From: Ramkumar Ramachandra <artagnon@gmail.com>
To: "Mislav Marohnić" <mislav.marohnic@gmail.com>
Cc: Brandon Casey <drafnel@gmail.com>,
Jonathan Nieder <jrnieder@gmail.com>,
Git List <git@vger.kernel.org>
Subject: [PATCH] commit: don't use-editor when allow-empty-message
Date: Mon, 27 May 2013 19:33:51 +0530 [thread overview]
Message-ID: <1369663431-2405-1-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <195A1F16-B587-4217-97BF-6A92DA8C0786@gmail.com>
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ć <mislav.marohnic@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
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);
strbuf_complete_line(buf);
+ if (allow_empty_message)
+ use_editor = 0;
}
return 0;
}
--
1.8.3.1.g33669de
next prev parent reply other threads:[~2013-05-27 14:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-25 19:12 Commit with an empty message broken since v1.8.2.1 Mislav Marohnić
2013-05-25 21:43 ` [PATCH] commit: don't start editor if empty message is given with -m René Scharfe
2013-05-27 14:03 ` Ramkumar Ramachandra [this message]
2013-05-27 14:07 ` [PATCH] commit: don't use-editor when allow-empty-message Ramkumar Ramachandra
2013-05-27 14:20 ` [PATCH v2] " Ramkumar Ramachandra
2013-05-27 14:53 ` Antoine Pelisse
2013-05-27 17:57 ` Ramkumar Ramachandra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369663431-2405-1-git-send-email-artagnon@gmail.com \
--to=artagnon@gmail.com \
--cc=drafnel@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=mislav.marohnic@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).