git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michele Ballabio <barra_cuda@katamail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] builtin-merge.c: Fix option parsing
Date: Sun, 20 Jul 2008 14:34:47 +0200	[thread overview]
Message-ID: <200807201434.47545.barra_cuda@katamail.com> (raw)

Now "git merge -m" needs a message, and errors out with the usage
text if none is given.
This way, t7600-merge.sh is fixed.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---
 builtin-merge.c  |    5 +++--
 t/t7600-merge.sh |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/builtin-merge.c b/builtin-merge.c
index 129b4e6..84a541d 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -68,10 +68,11 @@ static int option_parse_message(const struct option *opt,
 
 	if (unset)
 		strbuf_setlen(buf, 0);
-	else {
+	else if (arg) {
 		strbuf_addf(buf, "%s\n\n", arg);
 		have_message = 1;
-	}
+	} else
+		return error("switch `m' requires a value");
 	return 0;
 }
 
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 26cf8dc..5eeb6c2 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -221,7 +221,7 @@ test_expect_success 'setup' '
 
 test_debug 'gitk --all'
 
-test_expect_failure 'test option parsing' '
+test_expect_success 'test option parsing' '
 	test_must_fail git merge -$ c1 &&
 	test_must_fail git merge --no-such c1 &&
 	test_must_fail git merge -s foobar c1 &&
-- 
1.5.6.3

             reply	other threads:[~2008-07-20 12:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-20 12:34 Michele Ballabio [this message]
2008-07-20 13:08 ` [PATCH] builtin-merge.c: Fix option parsing Miklos Vajna

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200807201434.47545.barra_cuda@katamail.com \
    --to=barra_cuda@katamail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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 NNTP newsgroup(s).