From: Christian Couder Date: Sun, 31 Jul 2011 14:01:42 GMT Subject: Re: [PATCH 13/18] revert: Introduce --reset to remove sequencer state Message-ID: <201107311601.43472.chriscool@tuxfamily.org> In-Reply-To: <1311871951-3497-14-git-send-email-artagnon@gmail.com> On Thursday 28 July 2011 18:52:26 Ramkumar Ramachandra wrote: > > @@ -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); > }