git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Taylor Blau <me@ttaylorr.com>,
	Derrick Stolee <derrickstolee@github.com>
Subject: Re: [PATCH v2] format-patch: add --description-file option
Date: Sat, 12 Aug 2023 00:29:41 +0200	[thread overview]
Message-ID: <ZNa2VQQzZmaMzM4C@ugly> (raw)
In-Reply-To: <xmqq1qg9qmyq.fsf@gitster.g>

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.

>>  static void prepare_cover_text(struct pretty_print_context *pp,
>> +			       const char *description_file,
>>  			       const char *branch_name,
>
>This is kind of suboptimal, but let's let it pass.
>
>A better design is to pass the description string itself to this
>function and the make_cover_letter() function, and have the higher
>level callers of the callchain prepare the either read_desc_file()
>or read_branch_desc() to prepare that string before calling into the
>callchain. 
>
there is only one caller, and doing this change would essentially result 
in inlining prepare_cover_text(). probably not the best outcome.

>Such a division of labor between the callers and this
>function will allow us to more easily add another option to the
>command, to feed the description string itself (instead of having to
>create a temporary file and storing the description in it).
>
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.

regards

  reply	other threads:[~2023-08-11 22:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 17:09 [PATCH RESEND] format-patch: add --description-file option Oswald Buddenhagen
2023-08-08  6:33 ` Junio C Hamano
2023-08-09 17:15   ` [PATCH v2] " Oswald Buddenhagen
2023-08-11 21:38     ` Junio C Hamano
2023-08-11 22:29       ` Oswald Buddenhagen [this message]
2023-08-12  8:21         ` Junio C Hamano
2023-08-13  8:22           ` Oswald Buddenhagen
2023-08-21 17:07       ` [PATCH v3] " Oswald Buddenhagen
2023-08-21 17:59         ` Junio C Hamano
2023-08-21 22:05         ` Junio C Hamano
2023-08-23 20:01           ` Taylor Blau
2023-09-23 22:14         ` Kristoffer Haugsbakk
2023-09-25 19:01           ` Junio C Hamano
2023-09-25 19:29             ` Kristoffer Haugsbakk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZNa2VQQzZmaMzM4C@ugly \
    --to=oswald.buddenhagen@gmx.de \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).