Subject: Re: [PATCH v2 08/10] csum-file: introduce `hashfd_ext()`

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 10 Mar 2026 13:09:14 +0100

On Wed, Mar 04, 2026 at 02:11:31PM -0800, Junio C Hamano wrote:
> Patrick Steinhardt <[email-masked]> writes:
> 
> > -static struct hashfile *hashfd_internal(const struct git_hash_algo *algop,
> > -					int fd, const char *name,
> > -					struct progress *tp,
> > -					size_t buffer_len)
> > +struct hashfile *hashfd_ext(const struct git_hash_algo *algop,
> > +			    int fd, const char *name,
> > +			    const struct hashfd_options *opts)
> 
> What does _ext stand for?

"extended". It's a pattern that we use in lots of other places, too.

> More seriously, this essentially chooses to pick two parameters
> hashfd_internal() takes and put them in a struct, which would give
> us a clear upgrade path to add more to the structure without having
> to change the function signature.  But what is the criteria used to
> choose these two among 5 parameters the original function takes?

The criteria is mostly whether the parameter is optional or not. The
algorithm, file descriptor and name are all mandatory, whereas all the
other parts in the options structure are optional.

Patrick