Subject: Re: [PATCH v3] bulk-checkin: only support blobs in index_bulk_checkin

From: "Eric W. Biederman" <[email-masked]>
Date: Wed, 27 Sep 2023 15:06:40 -0500

Junio C Hamano <[email-masked]> writes:

> Taylor Blau <[email-masked]> writes:
>
>> I am not sure that I follow. If we have an address in memory from which
>> we want to stream raw bytes directly to the packfile, that should work
>> for all objects regardless of type, no?
>
> For a single hash world, yes.  For keeping track of "the other hash"
> and correspondence, you need to (1) interpret the contents of the
> object (e.g., if you received a tree contents for SHA-1 repository,
> you'd need to split them into tree entries and know which parts of
> the bytestream are SHA-1 hashes of the tree contebnts), (2) come
> up with the corresponding tree contents in the SHA-256 world (you
> should be able to do that now you know SHA-1 names of the objects
> directly referred to by the tree) and hash that using SHA-256, and
> (3) remember the SHA-1 and the SHA-256 name correspondence of the
> tree object you just hashed, in addition to the usual (4) hashing
> the contents using SHA-1 hash algorithm without caring what the byte
> stream represents.

If it helps I just posted a patchset that implements what it takes
to deal with objects small enough to live in-core.

You can read object-file-convert.c to see what it takes to generate
an object in the other hash function world.

The exercise for the reader is how to apply this to objects that
are too large to fit in memory.

Eric