summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2016-09-09 14:37:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-09-09 18:24:52 (GMT)
commit34b0528b735cd22e5600576c10904dff262b8332 (patch)
tree13e20d65d1fdbbb26449adf872ff43a22e2e7827 /sequencer.c
parentf74087f6ed21e65a926cb4facfa39d142eeffa96 (diff)
downloadgit-34b0528b735cd22e5600576c10904dff262b8332.zip
git-34b0528b735cd22e5600576c10904dff262b8332.tar.gz
git-34b0528b735cd22e5600576c10904dff262b8332.tar.bz2
sequencer: lib'ify walk_revs_populate_todo()
Instead of dying there, let the caller high up in the callchain notice the error and handle it (by dying, still). The function sequencer_pick_revisions() is the only caller of walk_revs_populate_todo(), and it already returns errors appropriately, so its caller must be already prepared to handle error returns, and with this step, we make it notice an error return from this function. So this is a safe conversion to make walk_revs_populate_todo() callable from new callers that want it not to die, without changing the external behaviour of anything existing. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sequencer.c b/sequencer.c
index 96b9ae1..ab599e0 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -809,17 +809,19 @@ static void read_populate_opts(struct replay_opts **opts_ptr)
die(_("Malformed options sheet: %s"), git_path_opts_file());
}
-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)
@@ -1102,8 +1104,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"));