[PATCH 2/8] fast-import: cache oe in parse_new_tag
- From
Dmitry Ivankov <divanorama@gmail.com>
- Date
- Sep 19, 2011, 01:27 UTC
- Message-ID
- <1316395657-6991-3-git-send-email-divanorama@gmail.com>
- In-Reply-To
- <1316395657-6991-1-git-send-email-divanorama@gmail.com>
parse_new_tag uses sha1_object_info to find out the type of an object given by a sha1 expression. But doesn't cache it in struct object_entry.
Make this call to sha1_object_info cached in struct object_entry.
Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> --- fast-import.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fast-import.c b/fast-import.c index 42f9b17..2b049f7 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2732,11 +2732,14 @@ static void parse_new_tag(void) type = oe->type; hashcpy(sha1, oe->idx.sha1); } else if (!get_sha1(from, sha1)) { - struct object_entry *oe = find_object(sha1); - if (!oe) { + struct object_entry *oe = insert_object(sha1); + if (!oe->idx.offset) { type = sha1_object_info(sha1, NULL); if (type < 0) die("Not a valid object: %s", from); + oe->type = type; + oe->pack_id = MAX_PACK_ID; + oe->idx.offset = 1; /* nonzero */ } else type = oe->type; } else
-- 1.7.3.4