[prev in list] [next in list] [prev in thread] [next in thread]
List: git
Subject: Re: [PATCH 12/18] revert: Make pick_commits functionally act on a commit list
From: Christian Couder <chriscool () tuxfamily ! org>
Date: 2011-07-31 20:52:50
Message-ID: 201107312252.50467.chriscool () tuxfamily ! org
[Download RAW message or body]
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic