sequencer: lib'ify prepare_revs()
Instead of dying there, let the caller high up in the callchain notice the error and handle it (by dying, still). The only caller of prepare_revs(), walk_revs_populate_todo() was just taught to return errors, after verifying that its callers are 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 prepare_revs() 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>
Johannes Schindelin committed
Sep 9, 2016 at 16:37 UTC
c3e8618c1f26f9b6b658d02a09530ae8eb85fc04
1 file changed
+4
-3
sequencer.c
+4
-3
@@ -623,7 +623,7 @@ leave:
623
return res;
624
}
625
626
-static void prepare_revs(struct replay_opts *opts)
626
+static int prepare_revs(struct replay_opts *opts)
627
{
628
/*
629
* picking (but not reverting) ranges (but not individual revisions)
@@ -633,10 +633,11 @@ static void prepare_revs(struct replay_opts *opts)
633
opts->revs->reverse ^= 1;
634
635
if (prepare_revision_walk(opts->revs))
636
- die(_("revision walk setup failed"));
636
+ return error(_("revision walk setup failed"));
637
638
if (!opts->revs->commits)
639
- die(_("empty commit set passed"));
639
+ return error(_("empty commit set passed"));
640
+ return 0;
641
}
642
643
static void read_and_refresh_cache(struct replay_opts *opts)