Skip to content

Commit ae25fd3

Browse files
stefanbellergitster
authored andcommitted
transport-helper: die on errors reading refs.
We check the return value of read_ref in 19 out of 21 cases. This adds checks to the missing cases. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent be94b33 commit ae25fd3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

transport-helper.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ static int fetch_with_import(struct transport *transport,
490490
else
491491
private = xstrdup(name);
492492
if (private) {
493-
read_ref(private, posn->old_sha1);
493+
if (read_ref(private, posn->old_sha1) < 0)
494+
die("Could not read ref %s", private);
494495
free(private);
495496
}
496497
}
@@ -1019,7 +1020,10 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
10191020
if (eon) {
10201021
if (has_attribute(eon + 1, "unchanged")) {
10211022
(*tail)->status |= REF_STATUS_UPTODATE;
1022-
read_ref((*tail)->name, (*tail)->old_sha1);
1023+
if (read_ref((*tail)->name,
1024+
(*tail)->old_sha1) < 0)
1025+
die(N_("Could not read ref %s"),
1026+
(*tail)->name);
10231027
}
10241028
}
10251029
tail = &((*tail)->next);

0 commit comments

Comments
 (0)