All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Packham <judge.packham@gmail.com>
To: git@vger.kernel.org
Cc: mah@jump-ing.de, peff@peff.net, jacob.keller@gmail.com,
	gitster@pobox.com, Chris Packham <judge.packham@gmail.com>
Subject: [PATCH 3/3] merge: Ensure '--abort' option takes no arguments
Date: Wed, 14 Dec 2016 21:37:57 +1300	[thread overview]
Message-ID: <20161214083757.26412-3-judge.packham@gmail.com> (raw)
In-Reply-To: <20161214083757.26412-1-judge.packham@gmail.com>

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>
---
Changes in v3:
- new

 builtin/merge.c  | 4 ++++
 t/t7600-merge.sh | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/builtin/merge.c b/builtin/merge.c
index 836ec281b..668aaffb8 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -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)."));
 
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 682139c4e..2ebda509a 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -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
-- 
2.11.0.24.ge6920cf


  parent reply	other threads:[~2016-12-14  8:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09  7:57 Any interest in 'git merge --continue' as a command Chris Packham
2016-12-09  9:11 ` Jeff King
2016-12-09 10:37   ` Jacob Keller
2016-12-09 19:16   ` Junio C Hamano
2016-12-10  8:49     ` Chris Packham
2016-12-10  9:00       ` Jeff King
2016-12-10 10:58         ` Jacob Keller
2016-12-12  8:34       ` [RFC/PATCH] merge: Add '--continue' option as a synonym for 'git commit' Chris Packham
2016-12-12  9:02         ` Markus Hitter
2016-12-13  8:33           ` Chris Packham
2016-12-12  9:40         ` Jeff King
2016-12-13  8:48         ` [PATCHv2 1/2] " Chris Packham
2016-12-13  8:48           ` [PATCHv2 2/2] completion: add --continue option for merge Chris Packham
2016-12-13 11:59           ` [PATCHv2 1/2] merge: Add '--continue' option as a synonym for 'git commit' Jeff King
2016-12-13 18:02           ` Junio C Hamano
2016-12-14  8:37           ` [PATCHv3 1/3] " Chris Packham
2016-12-14  8:37             ` [PATCH 2/3] completion: add --continue option for merge Chris Packham
2016-12-14  8:37             ` Chris Packham [this message]
2016-12-14 15:20             ` [PATCHv3 1/3] merge: Add '--continue' option as a synonym for 'git commit' Jeff King
2016-12-14 17:01               ` Junio C Hamano
2016-12-14 18:04             ` Junio C Hamano
2016-12-15  7:29               ` Chris Packham
2016-12-15 17:36                 ` Junio C Hamano
2016-12-15 17:43                   ` Jeff King
2016-12-10  8:59     ` Any interest in 'git merge --continue' as a command Jeff King
2016-12-10 18:16       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161214083757.26412-3-judge.packham@gmail.com \
    --to=judge.packham@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.keller@gmail.com \
    --cc=mah@jump-ing.de \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.