From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jeff King <peff@peff.net>
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Krzysztof Żelechowski" <giecrilj@stegny.2a.pl>,
git@vger.kernel.org,
"Hamza Mahfooz" <someguy@effective-light.com>
Subject: Re: *Really* noisy encoding warnings post-v2.33.0
Date: Sat, 23 Oct 2021 00:58:34 +0200 [thread overview]
Message-ID: <211023.86sfwsis1i.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <YWEBmJk0aENR5Yeo@coredump.intra.peff.net>
On Fri, Oct 08 2021, Jeff King wrote:
> On Fri, Oct 08, 2021 at 10:36:02PM -0400, Jeff King wrote:
>
>> If that were coupled with, say, an advise() call to explain that output
>> and matching might be inaccurate (and show that _once_), that might
>> might it more clear what's going on.
>>
>> Now I am sympathetic to flooding the user with too many messages, and
>> maybe reducing this to a single instance of "some commit messages could
>> not be re-encoded; output and matching might be inaccurate" is the right
>> thing. But in a sense, it's also working as designed: what you asked for
>> is producing wrong output over and over, and Git is saying so.
>
> The single-output version would perhaps be something like this:
>
> diff --git a/pretty.c b/pretty.c
> index 708b618cfe..c86f41bae7 100644
> --- a/pretty.c
> +++ b/pretty.c
> @@ -606,6 +606,21 @@ static char *replace_encoding_header(char *buf, const char *encoding)
> return strbuf_detach(&tmp, NULL);
> }
>
> +static void show_encoding_warning(const char *output_encoding)
> +{
> + static int seen_warning;
> +
> + if (seen_warning)
> + return;
> +
> + seen_warning = 1;
> + warning("one or more commits could not be re-encoded to '%s'",
> + output_encoding);
> + advise("When re-encoding fails, some output may be in an unexpected\n"
> + "encoding, and pattern matches against commit data may be\n"
> + "inaccurate.");
> +}
> +
> const char *repo_logmsg_reencode(struct repository *r,
> const struct commit *commit,
> char **commit_encoding,
> @@ -673,7 +688,7 @@ const char *repo_logmsg_reencode(struct repository *r,
> * case we just return the commit message verbatim.
> */
> if (!out) {
> - warning("unable to reencode commit to '%s'", output_encoding);
> + show_encoding_warning(output_encoding);
> return msg;
> }
> return out;
*Poke* about this. We're getting pretty close to release. I think the
WIP hunk I posted in
https://lore.kernel.org/git/871r4umfnm.fsf@evledraar.gmail.com/ presents
a good way forward with this.
I.e. aside from how wise it is to warn about this in general, I think
there's a pretty bad bug in your implementation where what should
effectively be a parse_options() or git_config()-time one-off warning is
being fired off for every single commit in "git log" in some cases.
next prev parent reply other threads:[~2021-10-22 23:00 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-24 9:00 git log --encoding=HTML is not supported Krzysztof Żelechowski
2021-08-24 10:31 ` Bagas Sanjaya
2021-08-24 10:33 ` Krzysztof Żelechowski
2021-08-24 10:46 ` Bagas Sanjaya
2021-08-24 19:11 ` Junio C Hamano
2021-08-25 0:57 ` Jeff King
2021-08-25 16:31 ` Junio C Hamano
2021-08-27 18:30 ` Jeff King
2021-08-27 18:32 ` Jeff King
2021-08-27 19:47 ` Junio C Hamano
2021-10-09 0:58 ` *Really* noisy encoding warnings post-v2.33.0 Ævar Arnfjörð Bjarmason
2021-10-09 1:29 ` Ævar Arnfjörð Bjarmason
2021-10-09 2:36 ` Jeff King
2021-10-09 2:42 ` Jeff King
2021-10-09 13:47 ` Ævar Arnfjörð Bjarmason
2021-10-27 11:03 ` Jeff King
2021-10-29 10:47 ` Ævar Arnfjörð Bjarmason
2021-10-29 20:40 ` Jeff King
2021-10-29 20:45 ` Junio C Hamano
2021-10-29 20:52 ` Junio C Hamano
2021-10-29 21:10 ` Jeff King
2021-10-22 22:58 ` Ævar Arnfjörð Bjarmason [this message]
2021-10-10 13:53 ` Johannes Sixt
2021-10-10 15:43 ` Ævar Arnfjörð Bjarmason
2021-08-25 23:00 ` git log --encoding=HTML is not supported Krzysztof Żelechowski
2021-08-27 18:33 ` Jeff King
2021-08-25 23:28 ` Krzysztof Żelechowski
2021-08-25 23:47 ` Bryan Turner
2021-08-26 15:37 ` Junio C Hamano
2021-08-26 20:52 ` Krzysztof Żelechowski
2021-08-27 15:59 ` Junio C Hamano
2021-08-27 18:37 ` Jeff King
2021-08-27 21:51 ` 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
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=211023.86sfwsis1i.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=giecrilj@stegny.2a.pl \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=someguy@effective-light.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).