Skip to content

Commit

Permalink
upload-pack: drop lookup-before-parse optimization
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Mar 17, 2013
1 parent 435c833 commit a6eec12
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions upload-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,7 @@ static int got_sha1(char *hex, unsigned char *sha1)
if (!has_sha1_file(sha1))
return -1;

o = lookup_object(sha1);
if (!(o && o->parsed))
o = parse_object(sha1);
o = parse_object(sha1);
if (!o)
die("oops (%s)", sha1_to_hex(sha1));
if (o->type == OBJ_COMMIT) {
Expand Down

0 comments on commit a6eec12

Please sign in to comment.