stash: convert branch to builtin
[gitweb.git] / builtin / revert.c
index b9d927eb09c9ed87c84681df1396f4e6d9b13c97..c93393c89be0290ebd9e300046ff56a2ee441715 100644 (file)
@@ -7,6 +7,7 @@
 #include "rerere.h"
 #include "dir.h"
 #include "sequencer.h"
+#include "branch.h"
 
 /*
  * This implements the builtins revert and cherry-pick.
@@ -173,7 +174,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
        } else {
                struct setup_revision_opt s_r_opt;
                opts->revs = xmalloc(sizeof(*opts->revs));
-               init_revisions(opts->revs, NULL);
+               repo_init_revisions(the_repository, opts->revs, NULL);
                opts->revs->no_walk = REVISION_WALK_NO_WALK_UNSORTED;
                if (argc < 2)
                        usage_with_options(usage_str, options);
@@ -191,8 +192,12 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
        opts->gpg_sign = xstrdup_or_null(opts->gpg_sign);
        opts->strategy = xstrdup_or_null(opts->strategy);
 
-       if (cmd == 'q')
-               return sequencer_remove_state(opts);
+       if (cmd == 'q') {
+               int ret = sequencer_remove_state(opts);
+               if (!ret)
+                       remove_branch_state();
+               return ret;
+       }
        if (cmd == 'c')
                return sequencer_continue(opts);
        if (cmd == 'a')
@@ -208,7 +213,7 @@ int cmd_revert(int argc, const char **argv, const char *prefix)
        if (isatty(0))
                opts.edit = 1;
        opts.action = REPLAY_REVERT;
-       git_config(git_default_config, NULL);
+       sequencer_init_config(&opts);
        res = run_sequencer(argc, argv, &opts);
        if (res < 0)
                die(_("revert failed"));
@@ -221,7 +226,7 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
        int res;
 
        opts.action = REPLAY_PICK;
-       git_config(git_default_config, NULL);
+       sequencer_init_config(&opts);
        res = run_sequencer(argc, argv, &opts);
        if (res < 0)
                die(_("cherry-pick failed"));