summaryrefslogtreecommitdiff
path: root/serve.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2021-08-27 18:30:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-08-27 19:43:22 (GMT)
commitfd680bc5586ab7c846e03e181e033dbc36cc7d5d (patch)
tree462addef547639e3f1ad2b15e04b799229cdb305 /serve.h
parent225bc32a989d7a22fa6addafd4ce7dcd04675dbf (diff)
downloadgit-fd680bc5586ab7c846e03e181e033dbc36cc7d5d.zip
git-fd680bc5586ab7c846e03e181e033dbc36cc7d5d.tar.gz
git-fd680bc5586ab7c846e03e181e033dbc36cc7d5d.tar.bz2
logmsg_reencode(): warn when iconv() fails
If the user asks for a pretty-printed commit to be converted (either explicitly with --encoding=foo, or implicitly because the commit is non-utf8 and we want to convert it), we pass it through iconv(). If that fails, we fall back to showing the input verbatim, but don't tell the user that the output may be bogus. Let's add a warning to do so, along with a mention in the documentation for --encoding. Two things to note about the implementation: - we could produce the warning closer to the call to iconv() in reencode_string_len(), which would let us relay the value of errno. But this is not actually very helpful. reencode_string_len() does not know we are operating on a commit, and indeed does not know that the caller won't produce an error of its own. And the errno values from iconv() are seldom helpful (iconv_open() only ever produces EINVAL; perhaps EILSEQ from iconv() might be illuminating, but it can also return EINVAL for incomplete sequences). - if the reason for the failure is that the output charset is not supported, then the user will see this warning for every commit we try to display. That might be ugly and overwhelming, but on the other hand it is making it clear that every one of them has not been converted (and the likely outcome anyway is to re-try the command with a supported output encoding). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'serve.h')
0 files changed, 0 insertions, 0 deletions