Re: [PATCH 12/18] revert: Make pick_commits functionally act on a commit list

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

 



On Thursday 28 July 2011 18:52:25 Ramkumar Ramachandra wrote:
> @@ -743,16 +741,6 @@ static int pick_commits(struct replay_opts *opts)
>  				opts->record_origin || opts->edit));
>  	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"));
> -	}
> -	save_head(sha1_to_hex(sha1));
> -	save_opts(opts);
> -
>  	for (cur = todo_list; cur; cur = cur->next) {
>  		save_todo(cur, opts);
>  		res = do_pick_commit(cur->item, opts);
> @@ -770,6 +758,27 @@ static int pick_commits(struct replay_opts *opts)
>  	return 0;
>  }
> 
> +static int pick_revisions(struct replay_opts *opts)
> +{
> +	struct commit_list *todo_list = NULL;
> +	unsigned char sha1[20];
> +
> +	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

This "else" could be removed.

> +		save_head(sha1_to_hex(sha1));
> +	save_opts(opts);
> +	save_todo(todo_list, opts);

This save_todo() could be removed too as pick_commits() already does it.

> +	return pick_commits(todo_list, opts);
> +}

Thanks,
Christian.
--
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]