Re: [PATCH v2 01/10] Define a structure for object IDs.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 15, 2015, 02:32 UTC
- Message-ID
- <xmqqy4mzuh1e.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CACsJy8CK=0QpsMpZKN6Js99xFRD6mpJW1id2BBQDMsV1DaHiPg@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
> Notice that the first time pack->obj[] is filled using > lookup_object(). So yes, the hash table has all the pointers that > pack->obj[] has.
Are we talking about the same thing?
By "the hash table", I mean **obj_hash that is a hashtable that uses <sha-1> form of identifier as the key. So "the hash table has all the pointers" sounds like all the objects you instantiate from a v4 packfile needs their object name known in the <sha-1> form anyway when it gets instantiated (or more importantly, when you realize there is another copy of it already in the **obj_hash hashtable, you may have to free or refrain from creating it in the first place).
As long as we use **obj_hash hashtable as "all the objects this process cares about in the world" and "struct object_id.hash" as the key into it, I do not think <pack,nth> representation belongs to that layer.
I do think <pack,nth> representation has its use as a short-cut mechanism to reach an indirectly referenced object directly without instantiating intermediate objects when dealing with an extended SHA-1 expression (cf. "v1.0^0:t" example in a few messages upthread). I just think it does not belong to "struct object_id" that are used to refer to in-core objects.