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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Right now this new option does nothing. It is just a start.

Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
---
 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


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]