Re: [PATCH 13/18] revert: Introduce --reset to remove sequencer state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);
>  }
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]