Re: *Really* noisy encoding warnings post-v2.33.0

Subsystems: documentation, the rest

2 messages, 2 authors, 2021-10-29 · open the first message on its own page

Re: *Really* noisy encoding warnings post-v2.33.0

From: Junio C Hamano <hidden>
Date: 2021-10-29 20:52:06

Junio C Hamano [off-list ref] writes:
Jeff King [off-list ref] writes:
quoted
TBH I am not even sure it is worth spending a lot of brain cells on the
"and then consider..." part. Over all these years, we've had one report,
and it simply misunderstand what "--encoding" was for. I thought it was
something we could fix up easily by checking a return value, but IMHO
doing it right is quite tricky because of iconv()'s limited interface,
and the risk of regression outweighs the potential benefit.
I tend to agree with the above.  Let's not over-engineer things.
----- >8 --------- >8 --------- >8 --------- >8 --------- >8 -----
From: Junio C Hamano <redacted>
Date: Fri, 29 Oct 2021 13:48:58 -0700
Subject: [PATCH] Revert "logmsg_reencode(): warn when iconv() fails"

This reverts commit fd680bc5 (logmsg_reencode(): warn when iconv()
fails, 2021-08-27).  Throwing a warning for each and every commit
that gets reencoded, without allowing a way to squelch, would make
it unpleasant for folks who have to deal with an ancient part of the
history in an old project that used wrong encoding in the commits.

Signed-off-by: Junio C Hamano <redacted>
---
 Documentation/pretty-options.txt | 4 +---
 pretty.c                         | 6 +-----
 t/t4210-log-i18n.sh              | 7 -------
 3 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/Documentation/pretty-options.txt b/Documentation/pretty-options.txt
index b3af850608..54d8bb3db0 100644
--- a/Documentation/pretty-options.txt
+++ b/Documentation/pretty-options.txt
@@ -40,9 +40,7 @@ people using 80-column terminals.
 	defaults to UTF-8. Note that if an object claims to be encoded
 	in `X` and we are outputting in `X`, we will output the object
 	verbatim; this means that invalid sequences in the original
-	commit may be copied to the output. Likewise, if iconv(3) fails
-	to convert the commit, we will output the original object
-	verbatim, along with a warning.
+	commit may be copied to the output.
 
 --expand-tabs=<n>::
 --expand-tabs::
diff --git a/pretty.c b/pretty.c
index 73b5ead509..9631529c10 100644
--- a/pretty.c
+++ b/pretty.c
@@ -671,11 +671,7 @@ const char *repo_logmsg_reencode(struct repository *r,
 	 * If the re-encoding failed, out might be NULL here; in that
 	 * case we just return the commit message verbatim.
 	 */
-	if (!out) {
-		warning("unable to reencode commit to '%s'", output_encoding);
-		return msg;
-	}
-	return out;
+	return out ? out : msg;
 }
 
 static int mailmap_name(const char **email, size_t *email_len,
diff --git a/t/t4210-log-i18n.sh b/t/t4210-log-i18n.sh
index 0141f36e33..d2dfcf164e 100755
--- a/t/t4210-log-i18n.sh
+++ b/t/t4210-log-i18n.sh
@@ -131,11 +131,4 @@ do
 	fi
 done
 
-test_expect_success 'log shows warning when conversion fails' '
-	enc=this-encoding-does-not-exist &&
-	git log -1 --encoding=$enc 2>err &&
-	echo "warning: unable to reencode commit to ${SQ}${enc}${SQ}" >expect &&
-	test_cmp expect err
-'
-
 test_done
-- 
2.33.1-1007-g607b33ccc6

Re: *Really* noisy encoding warnings post-v2.33.0

From: Jeff King <hidden>
Date: 2021-10-29 21:10:06

On Fri, Oct 29, 2021 at 01:52:02PM -0700, Junio C Hamano wrote:
quoted
I tend to agree with the above.  Let's not over-engineer things.
----- >8 --------- >8 --------- >8 --------- >8 --------- >8 -----
From: Junio C Hamano <redacted>
Date: Fri, 29 Oct 2021 13:48:58 -0700
Subject: [PATCH] Revert "logmsg_reencode(): warn when iconv() fails"

This reverts commit fd680bc5 (logmsg_reencode(): warn when iconv()
fails, 2021-08-27).  Throwing a warning for each and every commit
that gets reencoded, without allowing a way to squelch, would make
it unpleasant for folks who have to deal with an ancient part of the
history in an old project that used wrong encoding in the commits.
Thanks for tying this up.

I do think fd680bc5's documentation was good, though. So I'd suggest
squashing this in, or applying it on top.

-- >8 --
Subject: [PATCH] log: document --encoding behavior on iconv() failure

We already note that we may produce invalid output when we skip calling
iconv() altogether. But we may also do so if iconv() fails, and we have
no good alternative. Let's document this to avoid surprising users.

Signed-off-by: Jeff King <redacted>
---
 Documentation/pretty-options.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/pretty-options.txt b/Documentation/pretty-options.txt
index 54d8bb3db0..dc685be363 100644
--- a/Documentation/pretty-options.txt
+++ b/Documentation/pretty-options.txt
@@ -40,7 +40,9 @@ people using 80-column terminals.
 	defaults to UTF-8. Note that if an object claims to be encoded
 	in `X` and we are outputting in `X`, we will output the object
 	verbatim; this means that invalid sequences in the original
-	commit may be copied to the output.
+	commit may be copied to the output. Likewise, if iconv(3) fails
+	to convert the commit, we will quietly output the original
+	object verbatim.
 
 --expand-tabs=<n>::
 --expand-tabs::
-- 
2.33.1.1446.g3ed047b518
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help