Re: [PATCH 13/18] revert: Introduce --reset to remove sequencer state
From: Christian Couder <hidden>
Date: 2016-06-15 22:51:42
On Thursday 28 July 2011 18:52:26 Ramkumar Ramachandra wrote:
quoted hunk ↗ jump to hunk
@@ -765,17 +784,21 @@ static int pick_revisions(struct replay_opts *opts) read_and_refresh_cache(opts); - walk_revs_populate_todo(&todo_list, opts); - create_seq_dir(); - if (get_sha1("HEAD", sha1)) { - if (opts->action == REVERT) - die(_("Can't revert as initial commit")); - die(_("Can't cherry-pick into empty head")); - } else + if (opts->subcommand == REPLAY_RESET) { + remove_sequencer_state(1); + return 0; + } else {
Maybe you could remove this "else" so that the indentation level is reduced.
+ /* Start a new cherry-pick/ revert sequence */
+ walk_revs_populate_todo(&todo_list, opts);
+ create_seq_dir();
+ if (get_sha1("HEAD", sha1)) {
+ if (opts->action == REVERT)
+ die(_("Can't revert as initial commit"));
+ die(_("Can't cherry-pick into empty head"));
+ }
save_head(sha1_to_hex(sha1));
- save_opts(opts);
- save_todo(todo_list, opts);It looks like this save_todo() was not necessary in the first place because pick_commits() does a save_todo() before processing each commit.
- + save_opts(opts); + } return pick_commits(todo_list, opts); }