Subject: Re: [PATCH 14/23] hash.h, repository.h: reverse the order of these dependencies

From: Derrick Stolee <[email-masked]>
Date: Thu, 20 Apr 2023 09:14:10 -0400

On 4/20/2023 1:06 AM, Elijah Newren wrote:

> What would you think of either of the two following alternative solutions:
> 
>   * Move these into a new header, say "hash-repository.h" that folks
> could include.  People wanting to use these macros would have to
> include an alternate header, but one that is perhaps more logically
> named, and would allow other headers to get the basics of hash.h
> without repository.h
> 
>   * Move everything else in hash.h to a new header, say
> "hash-basics.h", which hash.h will #include.  That retains the ability
> for people to depend on hash.h and use these inline functions, while
> also giving other headers the option of including the basics of
> today's hash.h without repository.h.

I like both of these options, but prefer the second one.

This is mostly because most consumers in the Git codebase will want
these methods, and only the most fundamental hashing code will care
about hashing separate from the_hash_algo. So, the most-natural name
for "the header file that lets me hash stuff" would be "hash.h" and
"hash-basics.h" is for "I'm doing very simple, low-level hashing".

Thanks,
-Stolee