提交 042e290d 编写于 作者: C Chris Packham 提交者: Junio C Hamano

merge: ensure '--abort' option takes no arguments

Like '--continue', the '--abort' option doesn't make any sense with
other options or arguments to 'git merge' so ensure that none are
present.
Signed-off-by: NChris Packham <judge.packham@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 c261a87e
......@@ -1163,6 +1163,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
int nargc = 2;
const char *nargv[] = {"reset", "--merge", NULL};
if (orig_argc != 2)
usage_msg_opt("--abort expects no arguments",
builtin_merge_usage, builtin_merge_options);
if (!file_exists(git_path_merge_head()))
die(_("There is no merge to abort (MERGE_HEAD missing)."));
......
......@@ -154,6 +154,8 @@ test_expect_success 'test option parsing' '
test_must_fail git merge -s foobar c1 &&
test_must_fail git merge -s=foobar c1 &&
test_must_fail git merge -m &&
test_must_fail git merge --abort foobar &&
test_must_fail git merge --abort --quiet &&
test_must_fail git merge --continue foobar &&
test_must_fail git merge --continue --quiet &&
test_must_fail git merge
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册