git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builtin-merge.c: Fix option parsing
@ 2008-07-20 12:34 Michele Ballabio
  2008-07-20 13:08 ` Miklos Vajna
  0 siblings, 1 reply; 2+ messages in thread
From: Michele Ballabio @ 2008-07-20 12:34 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] builtin-merge.c: Fix option parsing
  2008-07-20 12:34 [PATCH] builtin-merge.c: Fix option parsing Michele Ballabio
@ 2008-07-20 13:08 ` Miklos Vajna
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Vajna @ 2008-07-20 13:08 UTC (permalink / raw)
  To: Michele Ballabio; +Cc: git, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

On Sun, Jul 20, 2008 at 02:34:47PM +0200, Michele Ballabio <barra_cuda@katamail.com> wrote:
> 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.

Thanks, I was about to fix this, but you were faster. ;-)

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-20 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-20 12:34 [PATCH] builtin-merge.c: Fix option parsing Michele Ballabio
2008-07-20 13:08 ` Miklos Vajna

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).