Browse Source

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>
maint
Michele Ballabio 17 years ago committed by Junio C Hamano
parent
commit
74f5b7fba4
  1. 5
      builtin-merge.c
  2. 2
      t/t7600-merge.sh

5
builtin-merge.c

@ -66,10 +66,11 @@ static int option_parse_message(const struct option *opt,


if (unset) if (unset)
strbuf_setlen(buf, 0); strbuf_setlen(buf, 0);
else { else if (arg) {
strbuf_addf(buf, "%s\n\n", arg); strbuf_addf(buf, "%s\n\n", arg);
have_message = 1; have_message = 1;
} } else
return error("switch `m' requires a value");
return 0; return 0;
} }



2
t/t7600-merge.sh

@ -221,7 +221,7 @@ test_expect_success 'setup' '


test_debug 'gitk --all' 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 -$ c1 &&
test_must_fail git merge --no-such c1 && test_must_fail git merge --no-such c1 &&
test_must_fail git merge -s foobar c1 && test_must_fail git merge -s foobar c1 &&

Loading…
Cancel
Save