Re: [PATCH 2/5] sha1_file: fix hardcoded size in null_sha1

2 messages, 2 authors, 2017-08-16 · open the first message on its own page

Re: [PATCH 2/5] sha1_file: fix hardcoded size in null_sha1

From: Junio C Hamano <hidden>
Date: 2017-08-15 19:02:36

Stefan Beller [off-list ref] writes:
Once we have 2 hash functions usable in a local Git installation,
this would be wasteful for the smaller hash function (and the
related grafts).

I think Jonathan once envisioned an 'optimized' version as a
second step, maybe this is a good time to discuss how we'd
get the right size for e.g. allocating memory, as _MAX_ seems
to be not the correct solution long term?
MAX is inevitable only if we envision that we have to handle objects
named using two or more hashing schemes at the same time, with the
same binary and during the same run inside a single process.

Using MAX may be nicer even if we use only one hashing scheme at a
time, though.

Re: [PATCH 2/5] sha1_file: fix hardcoded size in null_sha1

From: Patryk Obara <hidden>
Date: 2017-08-16 12:11:56

Junio C Hamano [off-list ref] wrote:
I said this is OK for "null" because we assume we will use ^\0{len}$
for any hash function we choose as the "impossible" value, and for
that particular use pattern, we do not need such a union.  Just
letting the caller peek at an appropriate number of bytes at the
beginning of that NUL buffer for hash the caller wants to use is
sufficient.
Do you think I should record this explanation as either commit message
or comment in sha1_file.c?
MAX is inevitable only if we envision that we have to handle objects
named using two or more hashing schemes at the same time, with the
same binary and during the same run inside a single process.
I think this will be the case if "transition one local repository at
a time" from Jonathan Nieder's transition plan will be followed.
This plan assumes object_id translation happening e.g. during fetch
operation.

-- 
| ← Ceci n'est pas une pipe
Patryk Obara
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help