@matheusbsbs / matheus-bagliano / commits / 74f5b7fba4
Fork 0

builtin-merge.c: Fix option parsing

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> Acked-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michele Ballabio committed Jul 20, 2008 at 14:34 UTC 74f5b7fba420eb6b807db48d0ee7a000202f8225
2 files changed +4 -3
builtin-merge.c
+3 -2
@@ -66,10 +66,11 @@ static int option_parse_message(const struct option *opt,
66
67 if (unset)
68 strbuf_setlen(buf, 0);
69 - else {
69 + else if (arg) {
70 strbuf_addf(buf, "%s\n\n", arg);
71 have_message = 1;
72 - }
72 + } else
73 + return error("switch `m' requires a value");
74 return 0;
75 }
76
t/t7600-merge.sh
+1 -1
@@ -221,7 +221,7 @@ test_expect_success 'setup' '
221
222 test_debug 'gitk --all'
223
224 -test_expect_failure 'test option parsing' '
224 +test_expect_success 'test option parsing' '
225 test_must_fail git merge -$ c1 &&
226 test_must_fail git merge --no-such c1 &&
227 test_must_fail git merge -s foobar c1 &&