Skip to content

Commit 81c3ce3

Browse files
stefanbellergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 32f5660 commit 81c3ce3

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

builtin/branch.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,9 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
653653
add_pending_object(&ref_list.revs,
654654
(struct object *) filter, "");
655655
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"));
657659
if (verbose)
658660
ref_list.maxwidth = calc_maxwidth(&ref_list);
659661
}

builtin/commit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,8 @@ static const char *find_author_by_nickname(const char *name)
989989
revs.mailmap = &mailmap;
990990
read_mailmap(revs.mailmap, NULL);
991991

992-
prepare_revision_walk(&revs);
992+
if (prepare_revision_walk(&revs))
993+
die(_("revision walk setup failed"));
993994
commit = get_revision(&revs);
994995
if (commit) {
995996
struct pretty_print_context ctx = {0};

remote.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1898,7 +1898,8 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs)
18981898

18991899
init_revisions(&revs, NULL);
19001900
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");
19021903

19031904
/* ... and count the commits on each side. */
19041905
*num_ours = 0;

0 commit comments

Comments
 (0)