]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sequencer: lib'ify prepare_revs()
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 9 Sep 2016 14:37:18 +0000 (16:37 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Sep 2016 18:24:52 +0000 (11:24 -0700)
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>
sequencer.c

index ab599e04df34bc26f705974864b38e453ac54497..7fd0f9965060c2f5e714bf41fb651c6417ac85ca 100644 (file)
@@ -623,7 +623,7 @@ leave:
        return res;
 }
 
-static void prepare_revs(struct replay_opts *opts)
+static int prepare_revs(struct replay_opts *opts)
 {
        /*
         * picking (but not reverting) ranges (but not individual revisions)
@@ -633,10 +633,11 @@ static void prepare_revs(struct replay_opts *opts)
                opts->revs->reverse ^= 1;
 
        if (prepare_revision_walk(opts->revs))
-               die(_("revision walk setup failed"));
+               return error(_("revision walk setup failed"));
 
        if (!opts->revs->commits)
-               die(_("empty commit set passed"));
+               return error(_("empty commit set passed"));
+       return 0;
 }
 
 static void read_and_refresh_cache(struct replay_opts *opts)