Subject: Re: [PATCH v2] format-patch: add --description-file option

From: Junio C Hamano <[email-masked]>
Date: Sat, 12 Aug 2023 01:21:46 -0700

Oswald Buddenhagen <[email-masked]> writes:

> On Fri, Aug 11, 2023 at 02:38:05PM -0700, Junio C Hamano wrote:
>>> +	if (strbuf_read_file(buf, desc_file, 2000) < 0)
>>
>>You would probably want to do "2000" -> "0" here.
>>
> hmm, yeah, i wonder where i got it from, given that there is no
> precedent. i suppose i simply thought that 2k is a reasonably
> expectable max size for a description. if you think the default 8k
> hint is a better idea, then let's go with it.

The suggestion was not about 2000 vs 8kiB, though it seems we stick
to power of 2 everywhere we are explicit.  Unless we know the exact
size from .st_size, that is.

It was primarily about this code not having any need to express its
own preference and go with whatever is the default.

> that's a good point. in fact, passing in the description directly
> would probably fit my use case better ... i just happened to already
> have the code for creating that temp file anyway (for editing), so i
> didn't give it a second thought. i can add both options in the same
> go, given that it's almost no code.

One thing that you may have to be careful about, if you also take
strings directly from the command line, is what to do with multiple
of them.  "git commit -m A -m B" that makes A and B separate
paragraphs with a break between them, I would think, would serve as
a good model that end-users already understand well.

Thanks.