+static int pick_revisions(struct replay_opts *opts)
+{
+ struct commit_list *todo_list = NULL;
+ unsigned char sha1[20];
+
+ read_and_refresh_cache(opts);
+
+ /*
+ * Decide what to do depending on the arguments; a fresh
+ * cherry-pick should be handled differently from an existing
+ * one that is being continued
+ */
+ 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);
+
+ return pick_commits(todo_list, opts);
+}
+