summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-06-05 21:59:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-06-05 21:59:53 (GMT)
commitbf9923171e299fec694153c68f06bfc1650e412d (patch)
tree53a5e9cccc3a735764d83e46555c9f2cd2d7e233 /builtin/commit.c
parent54b9b58a8c54533e7752dd1354ec313fa20138eb (diff)
parent25206778aac776fc6cc4887653fdae476c7a9b5a (diff)
downloadgit-bf9923171e299fec694153c68f06bfc1650e412d.zip
git-bf9923171e299fec694153c68f06bfc1650e412d.tar.gz
git-bf9923171e299fec694153c68f06bfc1650e412d.tar.bz2
Merge branch 'rs/commit-m-no-edit'
"git commit --allow-empty-message -m ''" should not start an editor. * rs/commit-m-no-edit: commit: don't start editor if empty message is given with -m
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index d2f30d9..1621dfc 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -107,7 +107,7 @@ static const char *cleanup_arg;
static enum commit_whence whence;
static int use_editor = 1, include_status = 1;
-static int show_ignored_in_status;
+static int show_ignored_in_status, have_option_m;
static const char *only_include_assumed;
static struct strbuf message = STRBUF_INIT;
@@ -121,9 +121,11 @@ static enum {
static int opt_parse_m(const struct option *opt, const char *arg, int unset)
{
struct strbuf *buf = opt->value;
- if (unset)
+ if (unset) {
+ have_option_m = 0;
strbuf_setlen(buf, 0);
- else {
+ } else {
+ have_option_m = 1;
if (buf->len)
strbuf_addch(buf, '\n');
strbuf_addstr(buf, arg);
@@ -975,7 +977,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
if (force_author && renew_authorship)
die(_("Using both --reset-author and --author does not make sense"));
- if (logfile || message.len || use_message || fixup_message)
+ if (logfile || have_option_m || use_message || fixup_message)
use_editor = 0;
if (0 <= edit_flag)
use_editor = edit_flag;