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 <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Jul 31, 2015 at 16:57 UTC ae25fd39bc6fdc3457976c8d3398aa0fda352f97
1 file changed +6 -2
transport-helper.c
+6 -2
@@ -490,7 +490,8 @@ static int fetch_with_import(struct transport *transport,
490 else
491 private = xstrdup(name);
492 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);
495 free(private);
496 }
497 }
@@ -1019,7 +1020,10 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
1020 if (eon) {
1021 if (has_attribute(eon + 1, "unchanged")) {
1022 (*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);
1027 }
1028 }
1029 tail = &((*tail)->next);