Skip to content

Commit 831244b

Browse files
chriscoolgitster
authored andcommitted
revert: cleanup code for -x option
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 81fa024 commit 831244b

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

builtin/revert.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ static void parse_args(int argc, const char **argv)
5858
struct option options[] = {
5959
OPT_BOOLEAN('n', "no-commit", &no_commit, "don't automatically commit"),
6060
OPT_BOOLEAN('e', "edit", &edit, "edit the commit message"),
61-
OPT_BOOLEAN('x', NULL, &no_replay, "append commit name when cherry-picking"),
6261
OPT_BOOLEAN('r', NULL, &noop, "no-op (backward compatibility)"),
6362
OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
6463
OPT_INTEGER('m', "mainline", &mainline, "parent number"),
@@ -71,6 +70,7 @@ static void parse_args(int argc, const char **argv)
7170

7271
if (action == CHERRY_PICK) {
7372
struct option cp_extra[] = {
73+
OPT_BOOLEAN('x', NULL, &no_replay, "append commit name"),
7474
OPT_BOOLEAN(0, "ff", &allow_ff, "allow fast-forward"),
7575
OPT_END(),
7676
};
@@ -379,10 +379,6 @@ static int revert_or_cherry_pick(int argc, const char **argv)
379379
setenv(GIT_REFLOG_ACTION, me, 0);
380380
parse_args(argc, argv);
381381

382-
/* this is copied from the shell script, but it's never triggered... */
383-
if (action == REVERT && !no_replay)
384-
die("revert is incompatible with replay");
385-
386382
if (allow_ff) {
387383
if (signoff)
388384
die("cherry-pick --ff cannot be used with --signoff");
@@ -546,14 +542,12 @@ int cmd_revert(int argc, const char **argv, const char *prefix)
546542
{
547543
if (isatty(0))
548544
edit = 1;
549-
no_replay = 1;
550545
action = REVERT;
551546
return revert_or_cherry_pick(argc, argv);
552547
}
553548

554549
int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
555550
{
556-
no_replay = 0;
557551
action = CHERRY_PICK;
558552
return revert_or_cherry_pick(argc, argv);
559553
}

0 commit comments

Comments
 (0)