]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/revert.c
Merge branch 'ja/misc-doc-fixes'
[thirdparty/git.git] / builtin / revert.c
index a47b53ceaff92d4079b4ea73a61ce1552ad66b05..f61cc5d82cf2697583b5851893ba4076f96643a5 100644 (file)
@@ -96,11 +96,14 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
 {
        const char * const * usage_str = revert_or_cherry_pick_usage(opts);
        const char *me = action_name(opts);
+       const char *cleanup_arg = NULL;
        int cmd = 0;
        struct option base_options[] = {
                OPT_CMDMODE(0, "quit", &cmd, N_("end revert or cherry-pick sequence"), '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_CMDMODE(0, "skip", &cmd, N_("skip current commit and continue"), 's'),
+               OPT_CLEANUP(&cleanup_arg),
                OPT_BOOL('n', "no-commit", &opts->no_commit, N_("don't automatically commit")),
                OPT_BOOL('e', "edit", &opts->edit, N_("edit the commit message")),
                OPT_NOOP_NOARG('r', NULL),
@@ -137,6 +140,11 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
        if (opts->keep_redundant_commits)
                opts->allow_empty = 1;
 
+       if (cleanup_arg) {
+               opts->default_msg_cleanup = get_cleanup_mode(cleanup_arg, 1);
+               opts->explicit_cleanup = 1;
+       }
+
        /* Check for incompatible command line arguments */
        if (cmd) {
                char *this_operation;
@@ -144,6 +152,8 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
                        this_operation = "--quit";
                else if (cmd == 'c')
                        this_operation = "--continue";
+               else if (cmd == 's')
+                       this_operation = "--skip";
                else {
                        assert(cmd == 'a');
                        this_operation = "--abort";
@@ -196,13 +206,15 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
        if (cmd == 'q') {
                int ret = sequencer_remove_state(opts);
                if (!ret)
-                       remove_branch_state(the_repository);
+                       remove_branch_state(the_repository, 0);
                return ret;
        }
        if (cmd == 'c')
                return sequencer_continue(the_repository, opts);
        if (cmd == 'a')
                return sequencer_rollback(the_repository, opts);
+       if (cmd == 's')
+               return sequencer_skip(the_repository, opts);
        return sequencer_pick_revisions(the_repository, opts);
 }