From: Junio C Hamano <gitster@pobox.com>
To: "Lidong Yan via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Phillip Wood <phillip.wood123@gmail.com>,
Lidong Yan <502024330056@smail.nju.edu.cn>
Subject: Re: [PATCH v3 2/2] BUG(): remove leading underscore of the format string
Date: Fri, 30 May 2025 06:15:19 -0700 [thread overview]
Message-ID: <xmqqbjragryw.fsf@gitster.g> (raw)
In-Reply-To: <e1f84c111f6b4b5d34201ee8858a8007ea898222.1748569955.git.gitgitgadget@gmail.com> (Lidong Yan via GitGitGadget's message of "Fri, 30 May 2025 01:52:35 +0000")
"Lidong Yan via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Lidong Yan <502024330056@smail.nju.edu.cn>
>
> BUG() is not end-user facing but programmer facing, and we do not
> use _("...") in them. I searched all `BUG(_` pattern and replace
> them with `BUG(`
The first sentence is good. We'd write the second sentence more
like
Replace all occurrences of BUG(_("..."), ...) with
BUG("...", ...).
I.e. you instruct somebody sitting in front of the keyboard who is
modifying the code for you what to do in imperative mood.
The changes themselves look good to me.
Thanks.
> Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
> ---
> builtin/mktag.c | 2 +-
> builtin/worktree.c | 2 +-
> pack-bitmap-write.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/mktag.c b/builtin/mktag.c
> index 7ac11c46d53f..1b1dc0263e18 100644
> --- a/builtin/mktag.c
> +++ b/builtin/mktag.c
> @@ -41,7 +41,7 @@ static int mktag_fsck_error_func(struct fsck_options *o UNUSED,
> fprintf_ln(stderr, _("error: tag input does not pass fsck: %s"), message);
> return 1;
> default:
> - BUG(_("%d (FSCK_IGNORE?) should never trigger this callback"),
> + BUG("%d (FSCK_IGNORE?) should never trigger this callback",
> msg_type);
> }
> }
> diff --git a/builtin/worktree.c b/builtin/worktree.c
> index 88a36ea9f867..2dceeeed8bd0 100644
> --- a/builtin/worktree.c
> +++ b/builtin/worktree.c
> @@ -621,7 +621,7 @@ static void print_preparing_worktree_line(int detach,
> else {
> struct commit *commit = lookup_commit_reference_by_name(branch);
> if (!commit)
> - BUG(_("unreachable: invalid reference: %s"), branch);
> + BUG("unreachable: invalid reference: %s", branch);
> fprintf_ln(stderr, _("Preparing worktree (detached HEAD %s)"),
> repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));
> }
> diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
> index 7f400ee01213..56960e6ad760 100644
> --- a/pack-bitmap-write.c
> +++ b/pack-bitmap-write.c
> @@ -1087,7 +1087,7 @@ void bitmap_writer_finish(struct bitmap_writer *writer,
> oid_access);
>
> if (commit_pos < 0)
> - BUG(_("trying to write commit not in index"));
> + BUG("trying to write commit not in index");
> stored->commit_pos = commit_pos + base_objects;
> }
next prev parent reply other threads:[~2025-05-30 13:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-14 12:44 [PATCH] sequencer: fix memory leak if `update_squash_messages()` failed Lidong Yan via GitGitGadget
2025-05-15 10:08 ` Phillip Wood
2025-05-15 16:20 ` Junio C Hamano
2025-05-15 16:43 ` lidongyan
2025-05-25 10:19 ` [PATCH v2] sequencer: replace error() with BUG() in update_squash_messages() Lidong Yan via GitGitGadget
2025-05-28 22:16 ` Junio C Hamano
2025-05-29 13:39 ` Phillip Wood
2025-05-30 4:29 ` Junio C Hamano
2025-06-02 13:59 ` Phillip Wood
2025-05-30 1:52 ` [PATCH v3 0/2] " Lidong Yan via GitGitGadget
2025-05-30 1:52 ` [PATCH v3 1/2] " Lidong Yan via GitGitGadget
2025-05-30 13:35 ` Junio C Hamano
2025-05-30 1:52 ` [PATCH v3 2/2] BUG(): remove leading underscore of the format string Lidong Yan via GitGitGadget
2025-05-30 13:15 ` Junio C Hamano [this message]
2025-06-03 2:01 ` [PATCH v4 0/2] sequencer: replace error() with BUG() in update_squash_messages() Lidong Yan via GitGitGadget
2025-06-03 2:01 ` [PATCH v4 1/2] " Lidong Yan via GitGitGadget
2025-06-03 2:01 ` [PATCH v4 2/2] BUG(): remove leading underscore of the format string Lidong Yan via GitGitGadget
2025-06-03 17:40 ` Junio C Hamano
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=xmqqbjragryw.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=502024330056@smail.nju.edu.cn \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=phillip.wood123@gmail.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.
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).