Re: [PATCH v2 08/10] csum-file: introduce `hashfd_ext()`
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 10, 2026, 12:09 UTC
- Message-ID
- <abAJ6mkYp5chzXrt@pks.im>
- In-Reply-To
- <xmqqjyvr5jos.fsf@gitster.g>
On Wed, Mar 04, 2026 at 02:11:31PM -0800, Junio C Hamano wrote:
Show 11 quoted lines
> Patrick Steinhardt <ps@pks.im> 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.
Show 5 quoted lines
> 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