Re: [PATCH 13/18] revert: Introduce --reset to remove sequencer state
- From
Christian Couder <chriscool@tuxfamily.org>
- Date
- Jul 31, 2011, 14:01 UTC
- 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:
Show 16 quoted lines
>
> @@ -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.
Show 11 quoted lines
> + /* 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.
Show 5 quoted lines
> - > + save_opts(opts); > + } > return pick_commits(todo_list, opts); > }