1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-22 22:36:09 +02:00

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>
This commit is contained in:
Stefan Beller 2015-07-31 16:57:57 -07:00 committed by Junio C Hamano
parent be94b339b6
commit ae25fd39bc

View File

@ -490,7 +490,8 @@ static int fetch_with_import(struct transport *transport,
else
private = xstrdup(name);
if (private) {
read_ref(private, posn->old_sha1);
if (read_ref(private, posn->old_sha1) < 0)
die("Could not read ref %s", private);
free(private);
}
}
@ -1019,7 +1020,10 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
if (eon) {
if (has_attribute(eon + 1, "unchanged")) {
(*tail)->status |= REF_STATUS_UPTODATE;
read_ref((*tail)->name, (*tail)->old_sha1);
if (read_ref((*tail)->name,
(*tail)->old_sha1) < 0)
die(N_("Could not read ref %s"),
(*tail)->name);
}
}
tail = &((*tail)->next);