Re: [PATCH v1] hash: handle invalid algorithms when formatting object IDs
On 2026-11-07 at 20:22:01, Tanga Joris wrote:
> Hi brian,
Show 24 quoted lines
> > This is not a valid configuration. I have a patch on my sha256-interop
> > branch, 5b208e4a3d34ffba0fbeafe991643d6d47a5caa0, that should make the
> > members not public. It depends partially on things other in that
> > series, but it should be fine to drop those pieces if you want to pick
> > that up and send it in.
> >
> > If you pass the structure from C, it's intended that it panics if algo
> > is zero. That's because we don't want to rely on the behaviour of
> > depending on a mutable global in Rust, since that's unsafe and leads to
> > action at a distance. We really should just drop that fallback and fix
> > all of the relevant callers at some point.
>
> That makes sense. I didn't know algo 0 coming from C is meant to
> panic in Rust, rather than depend on the default hash.
>
> Since this is shrimech's thread, I think shrimech could pick up
> 5b208e4a3d (making the ObjectID members private), and I'd be happy
> to review it.
>
> Could you also push 5b208e4a3d somewhere public? I could not fetch
> it from https://github.com/bk2204/git, whose sha256-interop branch
> seems to have an older version (c38d0c8475, "rust: don't expose the
> internals of ObjectID"). That would make it easier for shrimech to
> pick up.
Yeah, it's in the history of the temp-sha256-interop branch there.
--
brian m. carlson (they/them)
Toronto, Ontario, CA
Speaking for myself only