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: Chris Packham <judge.packham@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Chris Packham committed
Dec 14, 2016 at 21:37 UTC
042e290da6aee0a9f21cd5890ccf231c266e177e
2 files changed
+6
builtin/merge.c
+4
@@ -1163,6 +1163,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1163
int nargc = 2;
1164
const char *nargv[] = {"reset", "--merge", NULL};
1165
1166
+ if (orig_argc != 2)
1167
+ usage_msg_opt("--abort expects no arguments",
1168
+ builtin_merge_usage, builtin_merge_options);
1169
+
1170
if (!file_exists(git_path_merge_head()))
1171
die(_("There is no merge to abort (MERGE_HEAD missing)."));
1172
t/t7600-merge.sh
+2
@@ -154,6 +154,8 @@ test_expect_success 'test option parsing' '
154
test_must_fail git merge -s foobar c1 &&
155
test_must_fail git merge -s=foobar c1 &&
156
test_must_fail git merge -m &&
157
+ test_must_fail git merge --abort foobar &&
158
+ test_must_fail git merge --abort --quiet &&
159
test_must_fail git merge --continue foobar &&
160
test_must_fail git merge --continue --quiet &&
161
test_must_fail git merge