Thread (34 messages) flat view 34 messages, 3 authors, 2016-06-15

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

From: Christian Couder <hidden>
Date: 2016-06-15 22:51:42

On Thursday 28 July 2011 18:52:25 Ramkumar Ramachandra wrote:
quoted hunk ↗ jump to hunk
@@ -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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help