From: Junio C Hamano <gitster@pobox.com>
To: "ZHANG\, Le" <r0bertz@gentoo.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] i18n.repositoryencoding: a new variable specifying the encoding of blobs in the repository
Date: Mon, 18 Apr 2011 21:34:13 -0700 [thread overview]
Message-ID: <7vy6366ere.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1302987004-28134-1-git-send-email-r0bertz@gentoo.org> (Le ZHANG's message of "Sat, 16 Apr 2011 13:50:04 -0700")
"ZHANG, Le" <r0bertz@gentoo.org> writes:
> When not set it defaults to 'verbatim', nothing will be done.
> When set, the encoding of the blobs in repository will be converted to it.
> The original encoding is get from mail header.
>
> Signed-off-by: ZHANG, Le <r0bertz@gentoo.org>
As I suspect that you would need to reroll the [PATCH 1/2], my comment on
this patch might become unapplicable, but anyway...
> @@ -824,8 +825,10 @@ static int handle_commit_msg(struct strbuf *line)
> return 0;
> }
>
> -static void handle_patch(const struct strbuf *line)
> +static void handle_patch(struct strbuf *line)
> {
> + if (strcasecmp(repository_charset, "verbatim"))
> + convert_to(line, repository_charset, charset.buf);
I really do not want to see you call this strcasecmp for each and every
line of the input. The majority of the users (read: the current users who
are fine without using this new feature) do not want to pay the overhead.
How about doing it this way instead:
- Do not define repository_charset variable in this file; do not define
get_repository_encoding() function in environment.c; just declare
"const char *repository_encoding" in cache.h (as "extern const ...")
and define it in environment.c.
- git_default_i18n_config() in config.c reads i18n.repositoryencoding
into "repository_encoding". This variable is initialized to NULL when
the program is loaded, and as a special case, when the configuration
variable is "verbatim", this variable is reset to NULL. Otherwise it
will hold a copy of the string given by the configuration file (or -c
option from the command line).
- This callsite checks if repository_encoding is non-NULL, and if so
calls convert_to().
prev parent reply other threads:[~2011-04-19 4:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-16 20:50 [PATCH 2/2] i18n.repositoryencoding: a new variable specifying the encoding of blobs in the repository ZHANG, Le
2011-04-19 4:34 ` Junio C Hamano [this message]
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=7vy6366ere.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=r0bertz@gentoo.org \
/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).