[PATCH 07/15] sequencer: lib'ify read_populate_opts()
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 23, 2016, 16:07 UTC
- Message-ID
- <85a8ec8273994c599402c380abd383ad2f539777.1471968378.git.johannes.schindelin@gmx.de>
- In-Reply-To
- <cover.1471968378.git.johannes.schindelin@gmx.de>
To be truly useful, the sequencer should never die() but always return an error.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- sequencer.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/sequencer.c b/sequencer.c index 5f6b020..808cd53 100644 --- a/sequencer.c +++ b/sequencer.c @@ -806,12 +806,14 @@ static int populate_opts_cb(const char *key, const char *value, void *data) return 0; } -static void read_populate_opts(struct replay_opts **opts_ptr) +static int read_populate_opts(struct replay_opts **opts) { if (!file_exists(git_path_opts_file())) - return; - if (git_config_from_file(populate_opts_cb, git_path_opts_file(), *opts_ptr) < 0) - die(_("Malformed options sheet: %s"), git_path_opts_file()); + return 0; + if (git_config_from_file(populate_opts_cb, git_path_opts_file(), *opts) < 0) + return error(_("Malformed options sheet: %s"), + git_path_opts_file()); + return 0; } static void walk_revs_populate_todo(struct commit_list **todo_list, @@ -1017,8 +1019,8 @@ static int sequencer_continue(struct replay_opts *opts) if (!file_exists(git_path_todo_file())) return continue_single_pick(); - read_populate_opts(&opts); - if (read_populate_todo(&todo_list, opts)) + if (read_populate_opts(&opts) || + read_populate_todo(&todo_list, opts)) return -1; /* Verify that the conflict has been resolved */
-- 2.10.0.rc1.99.gcd66998