upload-pack: do not check NULL return of lookup_unknown_object

We check whether the return value of lookup_unknown_object
is NULL, but some code paths dereference it before our
check. This turns out not to be capable of causing a
segfault, though. The lookup_unknown_object function will
never return NULL, since the whole point is to allocate an
object struct if it does not find an existing one. So the
code here is not wrong, it is just confusing. Let's just
drop the NULL check.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2015-03-13 00:42:25 -04:00 committed by Junio C Hamano
parent e172755b1e
commit 8ddf3ca74f

View File

@ -688,8 +688,6 @@ static int mark_our_ref(const char *refname, const unsigned char *sha1)
o->flags |= HIDDEN_REF;
return 1;
}
if (!o)
die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1));
o->flags |= OUR_REF;
return 0;
}