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

[RFC/PATCH 13/18] revert: add option parsing for option --continue

From
Christian Couder <chriscool@tuxfamily.org>
Date
Nov 25, 2010, 21:20 UTC
Message-ID
<20101125212050.5188.59731.chriscool@tuxfamily.org>
In-Reply-To
<20101125210138.5188.13115.chriscool@tuxfamily.org>
Right now this new option does nothing. It is just a start.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 builtin/revert.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index 27e9d6f..12a2409 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -29,11 +29,13 @@
 
 static const char * const revert_usage[] = {
 	"git revert [options] <commit-ish>",
+	"git revert --continue",
 	NULL
 };
 
 static const char * const cherry_pick_usage[] = {
 	"git cherry-pick [options] <commit-ish>",
+	"git cherry-pick --continue",
 	NULL
 };
 
@@ -48,6 +50,7 @@ struct args_info {
 	int signoff;
 	int allow_ff;
 	int allow_rerere_auto;
+	int continuing;
 	const char *strategy;
 	const char **commit_argv;
 	int commit_argc;
@@ -72,6 +75,8 @@ static void parse_args(int argc, const char **argv, struct args_info *info)
 {
 	int noop;
 	struct option options[] = {
+		OPT_BOOLEAN(0, "continue", &info->continuing,
+			    "continue after resolving a conflict"),
 		OPT_BOOLEAN('n', "no-commit", &info->no_commit,
 			    "don't automatically commit"),
 		OPT_BOOLEAN('e', "edit", &info->edit, "edit the commit message"),
@@ -102,7 +107,18 @@ static void parse_args(int argc, const char **argv, struct args_info *info)
 					  PARSE_OPT_KEEP_UNKNOWN);
 	info->commit_argv = argv;
 
-	if (info->commit_argc < 2)
+	if (info->continuing) {
+		if (info->commit_argc != 1)
+			usage_msg_opt("No argument can be passed along "
+				      "with option --continue!",
+				      info->usage_str, options);
+		if (info->no_commit || info->edit || info->signoff ||
+		    info->mainline || info->allow_rerere_auto || info->strategy ||
+		    info->no_replay || info->allow_ff)
+			usage_msg_opt("No other option can be passed along "
+				      "with option --continue!",
+				      info->usage_str, options);
+	} else if (info->commit_argc < 2)
 		usage_with_options(info->usage_str, options);
 }
 
@@ -712,7 +728,10 @@ static int revert_or_cherry_pick(int argc, const char **argv, int revert, int ed
 	infos.action = revert ? REVERT : CHERRY_PICK;
 	parse_args(argc, argv, &infos);
 
-	res = pick_commits(&infos, &done_list);
+	if (infos.continuing)
+		res = 0;
+	else
+		res = pick_commits(&infos, &done_list);
 
 	free_commit_list(done_list);
 
-- 
1.7.3.2.504.g59d466
Previous: Christian CouderNext: Christian Couder
Message 21 of 27 in “WIP implement cherry-pick/revert --continue”
  1. 00/18 WIP implement cherry-pick/revert --continueChristian Couder, Nov 25, 2010
  2. 01/18 advice: add error_resolve_conflict() functionChristian Couder, Nov 25, 2010
  3. Jonathan NiederNov 26, 2010
  4. 02/18 revert: change many die() calls into "return error()" callsChristian Couder, Nov 25, 2010
  5. Jonathan NiederNov 26, 2010
  6. 03/18 usage: implement error_errno() the same way as die_errno()Christian Couder, Nov 25, 2010
  7. Jonathan NiederNov 26, 2010
  8. Junio C HamanoNov 26, 2010
  9. 04/18 revert: don't die when write_message() failsChristian Couder, Nov 25, 2010
  10. 05/18 commit: move reverse_commit_list() into commit.{h, c}Christian Couder, Nov 25, 2010
  11. 06/18 revert: remove "commit" global variableChristian Couder, Nov 25, 2010
  12. 07/18 revert: put option information in an option structChristian Couder, Nov 25, 2010
  13. Jonathan NiederNov 26, 2010
  14. Junio C HamanoNov 26, 2010
  15. 08/18 revert: refactor code into a new pick_commits() functionChristian Couder, Nov 25, 2010
  16. Daniel BarkalowNov 27, 2010
  17. 09/18 revert: make pick_commits() return an error on --ff incompatible optionChristian Couder, Nov 25, 2010
  18. 10/18 revert: make read_and_refresh_cache() and prepare_revs() return errorsChristian Couder, Nov 25, 2010
  19. 11/18 revert: add get_todo_content() and create_todo_file()Christian Couder, Nov 25, 2010
  20. 12/18 revert: write TODO and DONE files in case of failureChristian Couder, Nov 25, 2010
  21. 13/18 revert: add option parsing for option --continueChristian Couder, Nov 25, 2010
  22. 14/18 revert: move global variable "me" into "struct args_info"Christian Couder, Nov 25, 2010
  23. 15/18 revert: add NONE action and make parse_args() manage itChristian Couder, Nov 25, 2010
  24. 16/18 revert: implement parsing TODO and DONE filesChristian Couder, Nov 25, 2010
  25. 17/18 revert: add remaining instructions in todo fileChristian Couder, Nov 25, 2010
  26. 18/18 revert: implement --continue processingChristian Couder, Nov 25, 2010
  27. Jonathan NiederNov 26, 2010

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.