-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>
Junio C Hamano committed
Jan 9, 2007 at 21:31 UTC
bb1091a47516f898b757f897b8b398c84343a4e1
4 files changed
+21
-18
Documentation/git-mailinfo.txt
+7
-9
@@ -33,15 +33,13 @@ OPTIONS
33
format-patch --mbox' output.
34
35
-u::
36
- By default, the commit log message, author name and
37
- author email are taken from the e-mail without any
38
- charset conversion, after minimally decoding MIME
39
- transfer encoding. This flag causes the resulting
40
- commit to be encoded in the encoding specified by
41
- i18n.commitencoding configuration (defaults to utf-8) by
42
- transliterating them.
43
- Note that the patch is always used as is without charset
44
- conversion, even with this flag.
36
+ The commit log message, author name and author email are
37
+ taken from the e-mail, and after minimally decoding MIME
38
+ transfer encoding, re-coded in UTF-8 by transliterating
39
+ them. This used to be optional but now it is the default.
40
++
41
+Note that the patch is always used as-is without charset
42
+conversion, even with this flag.
43
44
--encoding=<encoding>::
45
Similar to -u but if the local convention is different
builtin-mailinfo.c
+11
-8
@@ -515,12 +515,9 @@ static void convert_to_utf8(char *line, char *charset)
515
char *input_charset = *charset ? charset : latin_one;
516
char *out = reencode_string(line, metainfo_charset, input_charset);
517
518
- if (!out) {
519
- fprintf(stderr, "cannot convert from %s to %s\n",
520
- input_charset, metainfo_charset);
521
- *charset = 0;
522
- return;
523
- }
518
+ if (!out)
519
+ die("cannot convert from %s to %s\n",
520
+ input_charset, metainfo_charset);
521
strcpy(line, out);
522
free(out);
523
}
@@ -797,17 +794,23 @@ static const char mailinfo_usage[] =
794
795
int cmd_mailinfo(int argc, const char **argv, const char *prefix)
796
{
797
+ const char *def_charset;
798
+
799
/* NEEDSWORK: might want to do the optional .git/ directory
800
* discovery
801
*/
802
git_config(git_default_config);
803
804
+ def_charset = (git_commit_encoding ? git_commit_encoding : "utf-8");
805
+ metainfo_charset = def_charset;
806
+
807
while (1 < argc && argv[1][0] == '-') {
808
if (!strcmp(argv[1], "-k"))
809
keep_subject = 1;
810
else if (!strcmp(argv[1], "-u"))
809
- metainfo_charset = (git_commit_encoding
810
- ? git_commit_encoding : "utf-8");
811
+ metainfo_charset = def_charset;
812
+ else if (!strcmp(argv[1], "-n"))
813
+ metainfo_charset = NULL;
814
else if (!strncmp(argv[1], "--encoding=", 11))
815
metainfo_charset = argv[1] + 11;
816
else
git-am.sh
+2
@@ -228,6 +228,8 @@ fi
228
if test "$(cat "$dotest/utf8")" = t
229
then
230
utf8=-u
231
+else
232
+ utf8=-n
233
fi
234
if test "$(cat "$dotest/keep")" = t
235
then
git-applymbox.sh
+1
-1
@@ -28,7 +28,7 @@ while case "$#" in 0) break ;; esac
28
do
29
case "$1" in
30
-u) utf8=-u ;;
31
- -n) utf8= ;;
31
+ -n) utf8=-n ;;
32
-k) keep_subject=-k ;;
33
-q) query_apply=t ;;
34
-c) continue="$2"; resume=f; shift ;;