remote: avoid passing NULL to read_ref()

read_ref() can (and in test t5800, actually *does*) return NULL.
Don't pass the NULL along to read_ref().  Coincidentally, this mistake
didn't make resolve_ref() blow up, but upcoming changes to
resolve_ref() will make it less forgiving.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael Haggerty 2011-09-15 23:10:38 +02:00 коммит произвёл Junio C Hamano
Родитель c28cce55e0
Коммит d51b720fca
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -446,9 +446,11 @@ static int fetch_with_import(struct transport *transport,
private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name);
else
private = xstrdup(posn->name);
if (private) {
read_ref(private, posn->old_sha1);
free(private);
}
}
strbuf_release(&buf);
return 0;
}