Re: [RFC PATCH 2/3] sha1-array: support appending unsigned char hash
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Jul 19, 2017, 23:56 UTC
- Message-ID
- <20170719165622.78e463fd@twelve2.svl.corp.google.com>
- In-Reply-To
- <CAGZ79kZ9Ewxv=8fnRZZaQjpyAdv8df81a9aLRkJzEt5ZU0VcTA@mail.gmail.com>
On Tue, 11 Jul 2017 15:06:11 -0700 Stefan Beller <sbeller@google.com> wrote:
Show 8 quoted lines
> On Tue, Jul 11, 2017 at 12:48 PM, Jonathan Tan <jonathantanmy@google.com> wrote: > > In a subsequent patch, sha1_file will need to append object names in the > > form of "unsigned char *" to oid arrays. Teach sha1-array support for > > that. > > > > Signed-off-by: Jonathan Tan <jonathantanmy@google.com> > > This breaks the oid/sha1 barrier?
Not sure what you mean by this. This patch is meant to be a change to make "unsigned char *"-using code able to create/modify oid arrays, while we migrate away from "unsigned char *" - I don't know of any barrier.
Show 7 quoted lines
> I would have expected the caller to do a > > oid_array_append_oid(&array, sha1_to_oid(sha1)); > > with sha1_to_oid working off some static memory, such that the > call to oid_array_append_oid (which we have as oid_array_append) > is just as cheap?
The solution you present would need 2 copies (one in sha1_to_oid, and another in oid_array_append), but the solution in this patch only requires one.
> Could you say more in the commit message on why we collude > sha1 and oids here?
I also don't understand this, but the answer to this is probably the same as the answer to your first question.