prepare_revision_walk(): check for return value in all places
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>
Stefan Beller committed
Aug 10, 2014 at 23:33 UTC
81c3ce3cdce8dffb913243f5b2cc09d9fb966e6c
3 files changed
+7
-3
builtin/branch.c
+3
-1
@@ -653,7 +653,9 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
653
add_pending_object(&ref_list.revs,
654
(struct object *) filter, "");
655
ref_list.revs.limited = 1;
656
- prepare_revision_walk(&ref_list.revs);
656
+
657
+ if (prepare_revision_walk(&ref_list.revs))
658
+ die(_("revision walk setup failed"));
659
if (verbose)
660
ref_list.maxwidth = calc_maxwidth(&ref_list);
661
}
builtin/commit.c
+2
-1
@@ -989,7 +989,8 @@ static const char *find_author_by_nickname(const char *name)
989
revs.mailmap = &mailmap;
990
read_mailmap(revs.mailmap, NULL);
991
992
- prepare_revision_walk(&revs);
992
+ if (prepare_revision_walk(&revs))
993
+ die(_("revision walk setup failed"));
994
commit = get_revision(&revs);
995
if (commit) {
996
struct pretty_print_context ctx = {0};
remote.c
+2
-1
@@ -1898,7 +1898,8 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs)
1898
1899
init_revisions(&revs, NULL);
1900
setup_revisions(rev_argc, rev_argv, &revs, NULL);
1901
- prepare_revision_walk(&revs);
1901
+ if (prepare_revision_walk(&revs))
1902
+ die("revision walk setup failed");
1903
1904
/* ... and count the commits on each side. */
1905
*num_ours = 0;