From: Johannes Schindelin Date: Tue, 23 Aug 2016 16:07:18 GMT Subject: [PATCH 08/15] sequencer: lib'ify walk_revs_populate_todo() Message-ID: In-Reply-To: To be truly useful, the sequencer should never die() but always return an error. Signed-off-by: Johannes Schindelin --- sequencer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sequencer.c b/sequencer.c index 808cd53..1bcea84 100644 --- a/sequencer.c +++ b/sequencer.c @@ -816,17 +816,19 @@ static int read_populate_opts(struct replay_opts **opts) return 0; } -static void walk_revs_populate_todo(struct commit_list **todo_list, +static int walk_revs_populate_todo(struct commit_list **todo_list, struct replay_opts *opts) { struct commit *commit; struct commit_list **next; - prepare_revs(opts); + if (prepare_revs(opts)) + return -1; next = todo_list; while ((commit = get_revision(opts->revs))) next = commit_list_append(commit, next); + return 0; } static int create_seq_dir(void) @@ -1111,8 +1113,8 @@ int sequencer_pick_revisions(struct replay_opts *opts) * progress */ - walk_revs_populate_todo(&todo_list, opts); - if (create_seq_dir() < 0) + if (walk_revs_populate_todo(&todo_list, opts) || + create_seq_dir() < 0) return -1; if (get_sha1("HEAD", sha1) && (opts->action == REPLAY_REVERT)) return error(_("Can't revert as initial commit")); -- 2.10.0.rc1.99.gcd66998