From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 1/3] upload-pack: drop lookup-before-parse optimization
Date: Sat, 16 Mar 2013 06:25:25 -0400 [thread overview]
Message-ID: <20130316102525.GA29533@sigill.intra.peff.net> (raw)
In-Reply-To: <20130316102428.GA29358@sigill.intra.peff.net>
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>
---
upload-pack.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/upload-pack.c b/upload-pack.c
index 30146a0..6bf81aa 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -325,9 +325,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) {
--
1.8.2.rc2.7.gef06216
next prev parent reply other threads:[~2013-03-16 10:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-16 10:24 [PATCH 0/3] fix unparsed object access in upload-pack Jeff King
2013-03-16 10:25 ` Jeff King [this message]
2013-03-16 10:27 ` [PATCH 2/3] upload-pack: make sure "want" objects are parsed Jeff King
2013-03-16 10:28 ` [PATCH 3/3] upload-pack: load non-tip "want" objects from disk Jeff King
2013-03-17 5:16 ` [PATCH 0/3] fix unparsed object access in upload-pack Junio C Hamano
2013-03-17 5:40 ` Jeff King
2013-03-17 6:17 ` Junio C Hamano
2013-03-17 8:47 ` Jeff King
2013-03-17 16:38 ` René Scharfe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130316102525.GA29533@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).