summaryrefslogtreecommitdiff
path: root/builtin-mailinfo.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-09 21:31:36 -0800
committerJunio C Hamano <junkio@cox.net>2007-01-09 21:32:49 -0800
commitbb1091a47516f898b757f897b8b398c84343a4e1 (patch)
treeca97aa37380489c955736855eec8054d1622fe87 /builtin-mailinfo.c
parent62c89c662fc6220522adc009aa95b1392350ed20 (diff)
downloadgit-bb1091a47516f898b757f897b8b398c84343a4e1.tar.gz
-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>
Diffstat (limited to 'builtin-mailinfo.c')
-rw-r--r--builtin-mailinfo.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index a67f3eb90b..583da38b67 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -515,12 +515,9 @@ static void convert_to_utf8(char *line, char *charset)
char *input_charset = *charset ? charset : latin_one;
char *out = reencode_string(line, metainfo_charset, input_charset);
- if (!out) {
- fprintf(stderr, "cannot convert from %s to %s\n",
- input_charset, metainfo_charset);
- *charset = 0;
- return;
- }
+ if (!out)
+ die("cannot convert from %s to %s\n",
+ input_charset, metainfo_charset);
strcpy(line, out);
free(out);
}
@@ -797,17 +794,23 @@ static const char mailinfo_usage[] =
int cmd_mailinfo(int argc, const char **argv, const char *prefix)
{
+ const char *def_charset;
+
/* NEEDSWORK: might want to do the optional .git/ directory
* discovery
*/
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] == '-') {
if (!strcmp(argv[1], "-k"))
keep_subject = 1;
else if (!strcmp(argv[1], "-u"))
- metainfo_charset = (git_commit_encoding
- ? git_commit_encoding : "utf-8");
+ metainfo_charset = def_charset;
+ else if (!strcmp(argv[1], "-n"))
+ metainfo_charset = NULL;
else if (!strncmp(argv[1], "--encoding=", 11))
metainfo_charset = argv[1] + 11;
else