git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] merge: Ensure '--abort' option takes no arguments

From
Chris Packham <judge.packham@gmail.com>
Date
Dec 14, 2016, 08:37 UTC
Message-ID
<20161214083757.26412-3-judge.packham@gmail.com>
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
Previous: Chris PackhamNext: Jeff King
Message 18 of 26 in “Any interest in 'git merge --continue' as a command”
  1. Chris PackhamDec 9, 2016
  2. Jeff KingDec 9, 2016
  3. Jacob KellerDec 9, 2016
  4. Junio C HamanoDec 9, 2016
  5. Chris PackhamDec 10, 2016
  6. Jeff KingDec 10, 2016
  7. Jacob KellerDec 10, 2016
  8. merge: Add '--continue' option as a synonym for 'git commit'Chris Packham, Dec 12, 2016
  9. Markus HitterDec 12, 2016
  10. Chris PackhamDec 13, 2016
  11. Jeff KingDec 12, 2016
  12. 1/2 merge: Add '--continue' option as a synonym for 'git commit'Chris Packham, Dec 13, 2016
  13. 2/2 completion: add --continue option for mergeChris Packham, Dec 13, 2016
  14. Jeff KingDec 13, 2016
  15. Junio C HamanoDec 13, 2016
  16. 1/3 merge: Add '--continue' option as a synonym for 'git commit'Chris Packham, Dec 14, 2016
  17. 2/3 completion: add --continue option for mergeChris Packham, Dec 14, 2016
  18. 3/3 merge: Ensure '--abort' option takes no argumentsChris Packham, Dec 14, 2016
  19. Jeff KingDec 14, 2016
  20. Junio C HamanoDec 14, 2016
  21. Junio C HamanoDec 14, 2016
  22. Chris PackhamDec 15, 2016
  23. Junio C HamanoDec 15, 2016
  24. Jeff KingDec 15, 2016
  25. Jeff KingDec 10, 2016
  26. Junio C HamanoDec 10, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.