@matheusbsbs / matheus-bagliano / commits / 6e1c6c103c
Fork 0

Make sure we barf on ref^{type} failure.

Martin Langhoff noticed that ref^0 barfed correctly when we did not have the commit in a broken repository, but ref^{commit} didn't. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Oct 19, 2005 at 22:48 UTC 6e1c6c103c522d01829f3a63992a023ff031e851
1 file changed +3 -1
sha1_name.c
+3 -1
@@ -323,6 +323,8 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
323 return -1;
324 if (!type_string) {
325 o = deref_tag(o);
326 + if (!o || (!o->parsed && !parse_object(o->sha1)))
327 + return -1;
328 memcpy(sha1, o->sha1, 20);
329 }
330 else {
@@ -332,7 +334,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
334 */
335
336 while (1) {
335 - if (!o)
337 + if (!o || (!o->parsed && !parse_object(o->sha1)))
338 return -1;
339 if (o->type == type_string) {
340 memcpy(sha1, o->sha1, 20);