upload-pack: drop lookup-before-parse optimization
When we receive a "have" line from the client, we want to load the object pointed to by the sha1. However, we are careful to do: o = lookup_object(sha1); if (!o || !o->parsed) o = parse_object(sha1); to avoid loading the object from disk if we have already seen it. However, since ccdc603 (parse_object: try internal cache before reading object db), parse_object already does this optimization internally. We can just call parse_object directly. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Mar 16, 2013 at 06:25 UTC
a6eec1263883ce9787a354e1635b7b732e72c3c9
1 file changed
+1
-3
upload-pack.c
+1
-3
@@ -327,9 +327,7 @@ static int got_sha1(char *hex, unsigned char *sha1)
327
if (!has_sha1_file(sha1))
328
return -1;
329
330
- o = lookup_object(sha1);
331
- if (!(o && o->parsed))
332
- o = parse_object(sha1);
330
+ o = parse_object(sha1);
331
if (!o)
332
die("oops (%s)", sha1_to_hex(sha1));
333
if (o->type == OBJ_COMMIT) {