]> git.ipfire.org Git - thirdparty/git.git/commitdiff
prepare_revision_walk(): check for return value in all places
authorStefan Beller <stefanbeller@gmail.com>
Sun, 10 Aug 2014 21:33:26 +0000 (23:33 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Aug 2014 18:00:33 +0000 (11:00 -0700)
Even the documentation tells us:

You should check if it returns any error (non-zero return
code) and if it does not, you can start using get_revision()
to do the iteration.

In preparation for this commit, I grepped all occurrences of
prepare_revision_walk and added error messages, when there were none.

Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c
builtin/commit.c
remote.c

index 652b1d2d1484032fab51165f1d0b0a41426d114f..e91ecc6fbd2f9e3966997c6e8fec0a5488f740fb 100644 (file)
@@ -653,7 +653,9 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
                add_pending_object(&ref_list.revs,
                                   (struct object *) filter, "");
                ref_list.revs.limited = 1;
-               prepare_revision_walk(&ref_list.revs);
+
+               if (prepare_revision_walk(&ref_list.revs))
+                       die(_("revision walk setup failed"));
                if (verbose)
                        ref_list.maxwidth = calc_maxwidth(&ref_list);
        }
index 39cf8976e3933a3d5310098896feaf674dedc12b..447ded63fd09b346ae5c1a0c6008dd196d6fd99e 100644 (file)
@@ -989,7 +989,8 @@ static const char *find_author_by_nickname(const char *name)
        revs.mailmap = &mailmap;
        read_mailmap(revs.mailmap, NULL);
 
-       prepare_revision_walk(&revs);
+       if (prepare_revision_walk(&revs))
+               die(_("revision walk setup failed"));
        commit = get_revision(&revs);
        if (commit) {
                struct pretty_print_context ctx = {0};
index 0e9459cc0675d2f232b1c1fda62080d04aa88ec5..dc0c427968e534c74bd853b12e261c529f1f9588 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1898,7 +1898,8 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs)
 
        init_revisions(&revs, NULL);
        setup_revisions(rev_argc, rev_argv, &revs, NULL);
-       prepare_revision_walk(&revs);
+       if (prepare_revision_walk(&revs))
+               die("revision walk setup failed");
 
        /* ... and count the commits on each side. */
        *num_ours = 0;