Skip to content

Commit a6eec12

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 435c833 commit a6eec12

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

upload-pack.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,7 @@ static int got_sha1(char *hex, unsigned char *sha1)
327327
if (!has_sha1_file(sha1))
328328
return -1;
329329

330-
o = lookup_object(sha1);
331-
if (!(o && o->parsed))
332-
o = parse_object(sha1);
330+
o = parse_object(sha1);
333331
if (!o)
334332
die("oops (%s)", sha1_to_hex(sha1));
335333
if (o->type == OBJ_COMMIT) {

0 commit comments

Comments
 (0)