From: Eric Sunshine <sunshine@sunshineco.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Rose via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, Seija Kijin <doremylover123@gmail.com>
Subject: Re: [PATCH] git: replace strbuf_addstr with strbuf_addch for all strings of length 2
Date: Wed, 18 Jan 2023 13:53:07 -0500 [thread overview]
Message-ID: <CAPig+cTrc7V+P6h039EsPwwRE4rw-qYGKHgGnGmp0TohfzHykA@mail.gmail.com> (raw)
In-Reply-To: <xmqqr0vr6d80.fsf@gitster.g>
On Wed, Jan 18, 2023 at 11:14 AM Junio C Hamano <gitster@pobox.com> wrote:
> > From: Seija Kijin <doremylover123@gmail.com>
> > This helps reduce overhead of calculating the length
>
> > diff --git a/builtin/am.c b/builtin/am.c
> > strbuf_addstr(&sb, "GIT_AUTHOR_NAME=");
> > sq_quote_buf(&sb, state->author_name);
> > - strbuf_addch(&sb, '\n');
> >
> > - strbuf_addstr(&sb, "GIT_AUTHOR_EMAIL=");
> > + strbuf_addstr(&sb, "\nGIT_AUTHOR_EMAIL=");
>
> This may reduce the number of lines, but markedly worsens the
> readability of the resulting code. Each of the three-line blocks in
> the original used to be logically complete and independent unit, but
> now each of them depend on what the last block wants.
Very much agree with this and all your other review comments.
> > - strbuf_addchars(dest, ' ', 2);
> > - strbuf_addstr(dest, "From inner merge:");
> > + strbuf_addstr(dest, " From inner merge:");
> > strbuf_addchars(dest, ' ', opt->priv->call_depth * 2);
>
> Ditto, even though this is not as horrible as the change to builtin/am.c
> we saw earlier.
Additionally, if this literal string ever gets wrapped in `_(...)`,
then the above change is even more undesirable due to the extra burden
it places on translators.
next prev parent reply other threads:[~2023-01-18 18:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 21:54 [PATCH] git: replace strbuf_addstr with strbuf_addch for all strings of length 2 Rose via GitGitGadget
2023-01-18 16:04 ` Junio C Hamano
2023-01-18 18:53 ` Eric Sunshine [this message]
2024-12-18 0:31 ` [PATCH v2] " AreaZR via GitGitGadget
2024-12-18 2:54 ` [PATCH v3] " AreaZR via GitGitGadget
2024-12-18 3:06 ` [PATCH v4] " AreaZR via GitGitGadget
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=CAPig+cTrc7V+P6h039EsPwwRE4rw-qYGKHgGnGmp0TohfzHykA@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=doremylover123@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
/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).