summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 650e4be)
raw | patch | inline | side by side (parent: 650e4be)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 28 Nov 2005 00:29:38 +0000 (16:29 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 28 Nov 2005 00:29:38 +0000 (16:29 -0800) |
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>
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>
mailinfo.c | patch | blob | history |
diff --git a/mailinfo.c b/mailinfo.c
index 6d8c93360fe084a4209277312a99fbb40d1c04bc..de105acaa8898b637e53b9a38ca695ec9514d817 100644 (file)
--- a/mailinfo.c
+++ b/mailinfo.c
#include <string.h>
#include <ctype.h>
#include <iconv.h>
+#include "cache.h"
#ifdef NO_STRCASESTR
extern char *gitstrcasestr(const char *haystack, const char *needle);
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]);