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

[PATCH v2 1/8] revert: cleanup code for -x option

From
Christian Couder <chriscool@tuxfamily.org>
Date
Jun 2, 2010, 05:58 UTC
Message-ID
<20100602055842.21504.54618.chriscool@tuxfamily.org>
In-Reply-To
<20100602055131.21504.71923.chriscool@tuxfamily.org>

There was some dead code and option -x appeared in the short help message of git revert (when running "git revert -h") which was wrong.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 builtin/revert.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index 7976b5a..5df0d69 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -58,7 +58,6 @@ static void parse_args(int argc, const char **argv)
 	struct option options[] = {
 		OPT_BOOLEAN('n', "no-commit", &no_commit, "don't automatically commit"),
 		OPT_BOOLEAN('e', "edit", &edit, "edit the commit message"),
-		OPT_BOOLEAN('x', NULL, &no_replay, "append commit name when cherry-picking"),
 		OPT_BOOLEAN('r', NULL, &noop, "no-op (backward compatibility)"),
 		OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
 		OPT_INTEGER('m', "mainline", &mainline, "parent number"),
@@ -71,6 +70,7 @@ static void parse_args(int argc, const char **argv)
 
 	if (action == CHERRY_PICK) {
 		struct option cp_extra[] = {
+			OPT_BOOLEAN('x', NULL, &no_replay, "append commit name"),
 			OPT_BOOLEAN(0, "ff", &allow_ff, "allow fast-forward"),
 			OPT_END(),
 		};
@@ -379,10 +379,6 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 	setenv(GIT_REFLOG_ACTION, me, 0);
 	parse_args(argc, argv);
 
-	/* this is copied from the shell script, but it's never triggered... */
-	if (action == REVERT && !no_replay)
-		die("revert is incompatible with replay");
-
 	if (allow_ff) {
 		if (signoff)
 			die("cherry-pick --ff cannot be used with --signoff");
@@ -546,14 +542,12 @@ int cmd_revert(int argc, const char **argv, const char *prefix)
 {
 	if (isatty(0))
 		edit = 1;
-	no_replay = 1;
 	action = REVERT;
 	return revert_or_cherry_pick(argc, argv);
 }
 
 int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
 {
-	no_replay = 0;
 	action = CHERRY_PICK;
 	return revert_or_cherry_pick(argc, argv);
 }
-- 
1.7.1.362.g8d752
Previous: Christian CouderNext: Christian Couder
Message 2 of 9 in “implement cherry-picking many commits”
  1. 0/8 implement cherry-picking many commitsChristian Couder, Jun 2, 2010
  2. 1/8 revert: cleanup code for -x optionChristian Couder, Jun 2, 2010
  3. 2/8 revert: use run_command_v_opt() instead of execv_git_cmd()Christian Couder, Jun 2, 2010
  4. 3/8 revert: refactor code into a do_pick_commit() functionChristian Couder, Jun 2, 2010
  5. 4/8 revert: change help_msg() to take no argumentChristian Couder, Jun 2, 2010
  6. 5/8 revert: allow cherry-picking more than one commitChristian Couder, Jun 2, 2010
  7. 6/8 revert: add tests to check cherry-picking many commitsChristian Couder, Jun 2, 2010
  8. 7/8 Documentation/cherry-pick: describe passing more than one commitChristian Couder, Jun 2, 2010
  9. 8/8 Documentation/revert: describe passing more than one commitChristian Couder, Jun 2, 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.