Browse Source

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 <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Christian Couder 15 years ago committed by Junio C Hamano
parent
commit
831244bd0d
  1. 8
      builtin/revert.c

8
builtin/revert.c

@ -58,7 +58,6 @@ static void parse_args(int argc, const char **argv)
struct option options[] = { struct option options[] = {
OPT_BOOLEAN('n', "no-commit", &no_commit, "don't automatically commit"), OPT_BOOLEAN('n', "no-commit", &no_commit, "don't automatically commit"),
OPT_BOOLEAN('e', "edit", &edit, "edit the commit message"), 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('r', NULL, &noop, "no-op (backward compatibility)"),
OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"), OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
OPT_INTEGER('m', "mainline", &mainline, "parent number"), OPT_INTEGER('m', "mainline", &mainline, "parent number"),
@ -71,6 +70,7 @@ static void parse_args(int argc, const char **argv)


if (action == CHERRY_PICK) { if (action == CHERRY_PICK) {
struct option cp_extra[] = { struct option cp_extra[] = {
OPT_BOOLEAN('x', NULL, &no_replay, "append commit name"),
OPT_BOOLEAN(0, "ff", &allow_ff, "allow fast-forward"), OPT_BOOLEAN(0, "ff", &allow_ff, "allow fast-forward"),
OPT_END(), OPT_END(),
}; };
@ -379,10 +379,6 @@ static int revert_or_cherry_pick(int argc, const char **argv)
setenv(GIT_REFLOG_ACTION, me, 0); setenv(GIT_REFLOG_ACTION, me, 0);
parse_args(argc, argv); 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 (allow_ff) {
if (signoff) if (signoff)
die("cherry-pick --ff cannot be used with --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)) if (isatty(0))
edit = 1; edit = 1;
no_replay = 1;
action = REVERT; action = REVERT;
return revert_or_cherry_pick(argc, argv); return revert_or_cherry_pick(argc, argv);
} }


int cmd_cherry_pick(int argc, const char **argv, const char *prefix) int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
{ {
no_replay = 0;
action = CHERRY_PICK; action = CHERRY_PICK;
return revert_or_cherry_pick(argc, argv); return revert_or_cherry_pick(argc, argv);
} }

Loading…
Cancel
Save