-u is now default for 'git-mailinfo'.

Originally from David Woodhouse, but also adjusts the callers of
mailinfo to the new default.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2007-01-09 21:31:36 -08:00
parent 62c89c662f
commit bb1091a475
4 changed files with 21 additions and 18 deletions

View File

@ -33,15 +33,13 @@ OPTIONS
format-patch --mbox' output. format-patch --mbox' output.
-u:: -u::
By default, the commit log message, author name and The commit log message, author name and author email are
author email are taken from the e-mail without any taken from the e-mail, and after minimally decoding MIME
charset conversion, after minimally decoding MIME transfer encoding, re-coded in UTF-8 by transliterating
transfer encoding. This flag causes the resulting them. This used to be optional but now it is the default.
commit to be encoded in the encoding specified by +
i18n.commitencoding configuration (defaults to utf-8) by Note that the patch is always used as-is without charset
transliterating them. conversion, even with this flag.
Note that the patch is always used as is without charset
conversion, even with this flag.
--encoding=<encoding>:: --encoding=<encoding>::
Similar to -u but if the local convention is different Similar to -u but if the local convention is different

View File

@ -515,12 +515,9 @@ static void convert_to_utf8(char *line, char *charset)
char *input_charset = *charset ? charset : latin_one; char *input_charset = *charset ? charset : latin_one;
char *out = reencode_string(line, metainfo_charset, input_charset); char *out = reencode_string(line, metainfo_charset, input_charset);
if (!out) { if (!out)
fprintf(stderr, "cannot convert from %s to %s\n", die("cannot convert from %s to %s\n",
input_charset, metainfo_charset); input_charset, metainfo_charset);
*charset = 0;
return;
}
strcpy(line, out); strcpy(line, out);
free(out); free(out);
} }
@ -797,17 +794,23 @@ static const char mailinfo_usage[] =
int cmd_mailinfo(int argc, const char **argv, const char *prefix) int cmd_mailinfo(int argc, const char **argv, const char *prefix)
{ {
const char *def_charset;
/* NEEDSWORK: might want to do the optional .git/ directory /* NEEDSWORK: might want to do the optional .git/ directory
* discovery * discovery
*/ */
git_config(git_default_config); git_config(git_default_config);
def_charset = (git_commit_encoding ? git_commit_encoding : "utf-8");
metainfo_charset = def_charset;
while (1 < argc && argv[1][0] == '-') { while (1 < argc && argv[1][0] == '-') {
if (!strcmp(argv[1], "-k")) if (!strcmp(argv[1], "-k"))
keep_subject = 1; keep_subject = 1;
else if (!strcmp(argv[1], "-u")) else if (!strcmp(argv[1], "-u"))
metainfo_charset = (git_commit_encoding metainfo_charset = def_charset;
? git_commit_encoding : "utf-8"); else if (!strcmp(argv[1], "-n"))
metainfo_charset = NULL;
else if (!strncmp(argv[1], "--encoding=", 11)) else if (!strncmp(argv[1], "--encoding=", 11))
metainfo_charset = argv[1] + 11; metainfo_charset = argv[1] + 11;
else else

View File

@ -228,6 +228,8 @@ fi
if test "$(cat "$dotest/utf8")" = t if test "$(cat "$dotest/utf8")" = t
then then
utf8=-u utf8=-u
else
utf8=-n
fi fi
if test "$(cat "$dotest/keep")" = t if test "$(cat "$dotest/keep")" = t
then then

View File

@ -28,7 +28,7 @@ while case "$#" in 0) break ;; esac
do do
case "$1" in case "$1" in
-u) utf8=-u ;; -u) utf8=-u ;;
-n) utf8= ;; -n) utf8=-n ;;
-k) keep_subject=-k ;; -k) keep_subject=-k ;;
-q) query_apply=t ;; -q) query_apply=t ;;
-c) continue="$2"; resume=f; shift ;; -c) continue="$2"; resume=f; shift ;;