From: Ramkumar Ramachandra Date: Mon, 01 Aug 2011 17:52:01 GMT Subject: Re: [PATCH 13/18] revert: Introduce --reset to remove sequencer state Message-ID: In-Reply-To: <201107311601.43472.chriscool@tuxfamily.org> Hi Christian, Christian Couder writes: > 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. This was intentional, mainly for stylistic reasons. See [1]. >> +             /* 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. Fixed in the earlier patch. Thanks! [1]: http://thread.gmane.org/gmane.comp.version-control.git/177960 Thanks. -- Ram