git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Calvin Wan <calvinwan@google.com>
To: Zev Weiss <zev@bewilderbeest.net>
Cc: "Calvin Wan" <calvinwan@google.com>,
	git@vger.kernel.org,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"René Scharfe" <l.s.r@web.de>,
	"Denton Liu" <liu.denton@gmail.com>,
	"Emma Brooks" <me@pluvano.com>,
	"Eric Sunshine" <sunshine@sunshineco.com>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Patrick Hemmer" <git@stormcloud9.net>
Subject: Re: [PATCH 3/5] log: Push to/cc handling down into show_log()
Date: Wed,  1 Feb 2023 23:52:51 +0000	[thread overview]
Message-ID: <20230201235253.1891546-3-calvinwan@google.com> (raw)
In-Reply-To: <20230119223858.29262-4-zev@bewilderbeest.net>

>  void log_write_email_headers(struct rev_info *opt, struct commit *commit,
>  			     const char **extra_headers_p,
>  			     int *need_8bit_cte_p,
> @@ -647,10 +655,12 @@ static void next_commentary_block(struct rev_info *opt, struct strbuf *sb)
>  void show_log(struct rev_info *opt)
>  {
>  	struct strbuf msgbuf = STRBUF_INIT;
> +	struct strbuf hdrbuf = STRBUF_INIT;
>  	struct log_info *log = opt->loginfo;
>  	struct commit *commit = log->commit, *parent = log->parent;
>  	int abbrev_commit = opt->abbrev_commit ? opt->abbrev : the_hash_algo->hexsz;
>  	const char *extra_headers = opt->extra_headers;
> +	char *to_free;
>  	struct pretty_print_context ctx = {0};
>  
>  	opt->loginfo = NULL;
> @@ -770,6 +780,11 @@ void show_log(struct rev_info *opt)
>  		ctx.notes_message = strbuf_detach(&notebuf, NULL);
>  	}
>  
> +	format_recipients(opt, &hdrbuf);
> +
> +	if (extra_headers)
> +		strbuf_addstr(&hdrbuf, extra_headers);
> +
>  	/*
>  	 * And then the pretty-printed message itself
>  	 */
> @@ -779,7 +794,7 @@ void show_log(struct rev_info *opt)
>  	ctx.date_mode = opt->date_mode;
>  	ctx.date_mode_explicit = opt->date_mode_explicit;
>  	ctx.abbrev = opt->diffopt.abbrev;
> -	ctx.after_subject = extra_headers;
> +	ctx.after_subject = to_free = strbuf_detach(&hdrbuf, NULL);

Can you explain in the commit message why hdrbuf, which contains the
output from format_recipients and extra_headers, is still the same
functionality as before?

> -void recipients_to_header_buf(const char *hdr, struct strbuf *buf,
> -			      const struct string_list *recipients);
> +void format_recipients(struct rev_info *rev, struct strbuf *sb);

What do you think about renaming this function to strbuf_add_recipients
and swapping the parameters? 

  parent reply	other threads:[~2023-02-01 23:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 22:38 [PATCH 0/5] format-patch: Add --{to,cc}-cmd support Zev Weiss
2023-01-19 22:38 ` [PATCH 1/5] t4014: Add test checking cover-letter To header Zev Weiss
2023-02-01 23:52   ` Calvin Wan
2023-01-19 22:38 ` [PATCH 2/5] log: Refactor duplicated code to headerize recipient lists Zev Weiss
2023-01-25  2:11   ` Junio C Hamano
2023-01-19 22:38 ` [PATCH 3/5] log: Push to/cc handling down into show_log() Zev Weiss
2023-01-20  0:33   ` Junio C Hamano
2023-02-01 23:52   ` Calvin Wan [this message]
2023-01-19 22:38 ` [PATCH 4/5] pretty: Add name_and_address_only parameter Zev Weiss
2023-01-25  2:23   ` Junio C Hamano
2023-02-01 23:52   ` Calvin Wan
2023-01-19 22:38 ` [PATCH 5/5] format-patch: Add support for --{to,cc}-cmd flags Zev Weiss
2023-02-01 23:52   ` Calvin Wan
2023-02-01 23:52 ` [PATCH 0/5] format-patch: Add --{to,cc}-cmd support Calvin Wan

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20230201235253.1891546-3-calvinwan@google.com \
    --to=calvinwan@google.com \
    --cc=avarab@gmail.com \
    --cc=git@stormcloud9.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    --cc=liu.denton@gmail.com \
    --cc=me@pluvano.com \
    --cc=sandals@crustytoothpaste.net \
    --cc=sunshine@sunshineco.com \
    --cc=zev@bewilderbeest.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).