summaryrefslogtreecommitdiff
path: root/mailinfo.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-28 00:29:38 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-11-28 00:29:38 (GMT)
commitf1f909e3185b5ee366e198042447afe749bfc813 (patch)
treec64901fa1a7f5fa19d025a315bcd1e5d5eae5d93 /mailinfo.c
parent650e4be59b9f385f56e5829d97d09e8440f174b8 (diff)
downloadgit-f1f909e3185b5ee366e198042447afe749bfc813.zip
git-f1f909e3185b5ee366e198042447afe749bfc813.tar.gz
git-f1f909e3185b5ee366e198042447afe749bfc813.tar.bz2
mailinfo: Use i18n.commitencoding
This uses i18n.commitencoding configuration item to pick up the default commit encoding for the repository when converting form e-mail encoding to commit encoding (the default is utf8). Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'mailinfo.c')
-rw-r--r--mailinfo.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/mailinfo.c b/mailinfo.c
index 6d8c933..de105ac 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -8,6 +8,7 @@
#include <string.h>
#include <ctype.h>
#include <iconv.h>
+#include "cache.h"
#ifdef NO_STRCASESTR
extern char *gitstrcasestr(const char *haystack, const char *needle);
@@ -718,27 +719,27 @@ static void handle_body(void)
static const char mailinfo_usage[] =
"git-mailinfo [-k] [-u] msg patch <mail >info";
-static void usage(void) {
- fprintf(stderr, "%s\n", mailinfo_usage);
- exit(1);
-}
-
int main(int argc, char **argv)
{
+ /* NEEDSWORK: might want to do the optional .git/ directory
+ * discovery
+ */
+ git_config(git_default_config);
+
while (1 < argc && argv[1][0] == '-') {
if (!strcmp(argv[1], "-k"))
keep_subject = 1;
else if (!strcmp(argv[1], "-u"))
- metainfo_charset = "utf-8";
+ metainfo_charset = git_commit_encoding;
else if (!strncmp(argv[1], "-u=", 3))
metainfo_charset = argv[1] + 3;
else
- usage();
+ usage(mailinfo_usage);
argc--; argv++;
}
if (argc != 3)
- usage();
+ usage(mailinfo_usage);
cmitmsg = fopen(argv[1], "w");
if (!cmitmsg) {
perror(argv[1]);