Subject: Re: [PATCH] [PATCH] [Outreachy] builtin/patch-id.c: clarify SHA1 usage for patch IDs

From: Junio C Hamano <[email-masked]>
Date: Wed, 15 Oct 2025 06:37:01 -0700

"brian m. carlson" <[email-masked]> writes:

> Given that context, I think allowing the specification of an algorithm
> would allow people to say, "Yes, I am in a SHA-256 repository, but I
> want SHA-1," or vice versa, which would work with your use case better.

That is sensible.

In short, the automatic choice is to use the repository's hash
inside a repository, or use the then-default algorithm (which comes
from the preimage of the patch we discussed in this thread) outside
a repository.  We want a "Use this hash algorithm, ignoring the
automatic choice" command line option that overrides it.

If we were to do configuration variables, we may need two.  One to
replace only the fallback part (i.e. outside a repository, instead
of using whatever then-current algorithm, use this one), and the
other to act as if the above command line option is always given.

But as always, starting with only a command line option would be a
prudent way forward.

Thanks.