From: Junio C Hamano Date: Sun, 29 Jan 2012 21:18:55 +0000 (-0800) Subject: Merge branch 'jk/parse-object-cached' X-Git-Tag: v1.7.10-rc0~138 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d1afa8baa271fe0df1a15a6800f23f972abc5293?ds=inline;hp=-c Merge branch 'jk/parse-object-cached' * jk/parse-object-cached: upload-pack: avoid parsing tag destinations upload-pack: avoid parsing objects during ref advertisement parse_object: try internal cache before reading object db --- d1afa8baa271fe0df1a15a6800f23f972abc5293 diff --combined upload-pack.c index 0d11e21a68,c01e161a9d..bb08e2eb0d --- a/upload-pack.c +++ b/upload-pack.c @@@ -585,7 -585,6 +585,7 @@@ static void receive_needs(void write_str_in_full(debug_fd, "#S\n"); for (;;) { struct object *o; + const char *features; unsigned char sha1_buf[20]; len = packet_read_line(0, line, sizeof(line)); reset_timeout(); @@@ -617,26 -616,23 +617,26 @@@ get_sha1_hex(line+5, sha1_buf)) die("git upload-pack: protocol error, " "expected to get sha, not '%s'", line); - if (strstr(line+45, "multi_ack_detailed")) + + features = line + 45; + + if (parse_feature_request(features, "multi_ack_detailed")) multi_ack = 2; - else if (strstr(line+45, "multi_ack")) + else if (parse_feature_request(features, "multi_ack")) multi_ack = 1; - if (strstr(line+45, "no-done")) + if (parse_feature_request(features, "no-done")) no_done = 1; - if (strstr(line+45, "thin-pack")) + if (parse_feature_request(features, "thin-pack")) use_thin_pack = 1; - if (strstr(line+45, "ofs-delta")) + if (parse_feature_request(features, "ofs-delta")) use_ofs_delta = 1; - if (strstr(line+45, "side-band-64k")) + if (parse_feature_request(features, "side-band-64k")) use_sideband = LARGE_PACKET_MAX; - else if (strstr(line+45, "side-band")) + else if (parse_feature_request(features, "side-band")) use_sideband = DEFAULT_PACKET_MAX; - if (strstr(line+45, "no-progress")) + if (parse_feature_request(features, "no-progress")) no_progress = 1; - if (strstr(line+45, "include-tag")) + if (parse_feature_request(features, "include-tag")) use_include_tag = 1; o = lookup_object(sha1_buf); @@@ -724,11 -720,14 +724,14 @@@ static int send_ref(const char *refname static const char *capabilities = "multi_ack thin-pack side-band" " side-band-64k ofs-delta shallow no-progress" " include-tag multi_ack_detailed"; - struct object *o = parse_object(sha1); + struct object *o = lookup_unknown_object(sha1); const char *refname_nons = strip_namespace(refname); - if (!o) - die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1)); + if (o->type == OBJ_NONE) { + o->type = sha1_object_info(sha1, NULL); + if (o->type < 0) + die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1)); + } if (capabilities) packet_write(1, "%s %s%c%s%s\n", sha1_to_hex(sha1), refname_nons, @@@ -742,7 -741,7 +745,7 @@@ nr_our_refs++; } if (o->type == OBJ_TAG) { - o = deref_tag(o, refname, 0); + o = deref_tag_noverify(o); if (o) packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname_nons); }