The old --quit remains supported, just hidden away. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- Documentation/git-cherry-pick.txt | 2 +- Documentation/git-revert.txt | 2 +- Documentation/sequencer.txt | 2 +- builtin/revert.c | 7 +++++-- contrib/completion/git-completion.bash | 4 ++-- sequencer.c | 2 +- t/t3510-cherry-pick-sequence.sh | 14 +++++++------- t/t3511-cherry-pick-x.sh | 2 +- 8 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index 6154e57..de878ff 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -11,7 +11,7 @@ SYNOPSIS 'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] [-S[<keyid>]] <commit>... 'git cherry-pick' --continue -'git cherry-pick' --quit +'git cherry-pick' --forget 'git cherry-pick' --abort DESCRIPTION diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt index 573616a..c21a43b 100644 --- a/Documentation/git-revert.txt +++ b/Documentation/git-revert.txt @@ -10,7 +10,7 @@ SYNOPSIS [verse] 'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>... 'git revert' --continue -'git revert' --quit +'git revert' --forget 'git revert' --abort DESCRIPTION diff --git a/Documentation/sequencer.txt b/Documentation/sequencer.txt index 5747f44..ddfaad6 100644 --- a/Documentation/sequencer.txt +++ b/Documentation/sequencer.txt @@ -3,7 +3,7 @@ '.git/sequencer'. Can be used to continue after resolving conflicts in a failed cherry-pick or revert. ---quit:: +--forget:: Forget about the current operation in progress. Can be used to clear the sequencer state after a failed cherry-pick or revert. diff --git a/builtin/revert.c b/builtin/revert.c index 56a2c36..663eaf7 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -77,7 +77,10 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) const char *me = action_name(opts); int cmd = 0; struct option options[] = { - OPT_CMDMODE(0, "quit", &cmd, N_("end revert or cherry-pick sequence"), 'q'), + OPT_CMDMODE(0, "forget", &cmd, N_("end revert or cherry-pick sequence"), 'q'), + { OPTION_CMDMODE, 0, "quit", &cmd, NULL, + N_("end revert or cherry-pick sequence"), + PARSE_OPT_NOARG|PARSE_OPT_NONEG|PARSE_OPT_HIDDEN, NULL, 'q' }, OPT_CMDMODE(0, "continue", &cmd, N_("resume revert or cherry-pick sequence"), 'c'), OPT_CMDMODE(0, "abort", &cmd, N_("cancel revert or cherry-pick sequence"), 'a'), OPT_BOOL('n', "no-commit", &opts->no_commit, N_("don't automatically commit")), @@ -134,7 +137,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) if (opts->subcommand != REPLAY_NONE) { char *this_operation; if (opts->subcommand == REPLAY_REMOVE_STATE) - this_operation = "--quit"; + this_operation = "--forget"; else if (opts->subcommand == REPLAY_CONTINUE) this_operation = "--continue"; else { diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 8159f28..d5c74e7 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1047,7 +1047,7 @@ _git_cherry_pick () { local dir="$(__gitdir)" if [ -f "$dir"/CHERRY_PICK_HEAD ]; then - __gitcomp "--continue --quit --abort" + __gitcomp "--continue --forget --abort" return fi case "$cur" in @@ -2303,7 +2303,7 @@ _git_revert () { local dir="$(__gitdir)" if [ -f "$dir"/REVERT_HEAD ]; then - __gitcomp "--continue --quit --abort" + __gitcomp "--continue --forget --abort" return fi case "$cur" in diff --git a/sequencer.c b/sequencer.c index e66f2fe..12d10d0 100644 --- a/sequencer.c +++ b/sequencer.c @@ -812,7 +812,7 @@ static int create_seq_dir(void) { if (file_exists(git_path_seq_dir())) { error(_("a cherry-pick or revert is already in progress")); - advise(_("try \"git cherry-pick (--continue | --quit | --abort)\"")); + advise(_("try \"git cherry-pick (--continue | --forget | --abort)\"")); return -1; } else if (mkdir(git_path_seq_dir(), 0777) < 0) diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh index 7b7a89d..d84fafa 100755 --- a/t/t3510-cherry-pick-sequence.sh +++ b/t/t3510-cherry-pick-sequence.sh @@ -18,7 +18,7 @@ test_description='Test cherry-pick continuation features _r10='\1\1\1\1\1\1\1\1\1\1' pristine_detach () { - git cherry-pick --quit && + git cherry-pick --forget && git checkout -f "$1^0" && git read-tree -u --reset HEAD && git clean -d -f -f -q -x @@ -89,9 +89,9 @@ test_expect_success 'cherry-pick cleans up sequencer state upon success' ' test_path_is_missing .git/sequencer ' -test_expect_success '--quit does not complain when no cherry-pick is in progress' ' +test_expect_success '--forget does not complain when no cherry-pick is in progress' ' pristine_detach initial && - git cherry-pick --quit + git cherry-pick --forget ' test_expect_success '--abort requires cherry-pick in progress' ' @@ -99,14 +99,14 @@ test_expect_success '--abort requires cherry-pick in progress' ' test_must_fail git cherry-pick --abort ' -test_expect_success '--quit cleans up sequencer state' ' +test_expect_success '--forget cleans up sequencer state' ' pristine_detach initial && test_expect_code 1 git cherry-pick base..picked && - git cherry-pick --quit && + git cherry-pick --forget && test_path_is_missing .git/sequencer ' -test_expect_success '--quit keeps HEAD and conflicted index intact' ' +test_expect_success '--forget keeps HEAD and conflicted index intact' ' pristine_detach initial && cat >expect <<-\EOF && OBJID @@ -116,7 +116,7 @@ test_expect_success '--quit keeps HEAD and conflicted index intact' ' :000000 100644 OBJID OBJID A unrelated EOF test_expect_code 1 git cherry-pick base..picked && - git cherry-pick --quit && + git cherry-pick --forget && test_path_is_missing .git/sequencer && test_must_fail git update-index --refresh && { diff --git a/t/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh index 9cce5ae..a56d48e 100755 --- a/t/t3511-cherry-pick-x.sh +++ b/t/t3511-cherry-pick-x.sh @@ -5,7 +5,7 @@ test_description='Test cherry-pick -x and -s' . ./test-lib.sh pristine_detach () { - git cherry-pick --quit && + git cherry-pick --forget && git checkout -f "$1^0" && git read-tree -u --reset HEAD && git clean -d -f -f -q -x -- 2.8.2.524.g6ff3d78