Makefile: fix shell quoting
[gitweb.git] / builtin-mailinfo.c
index e1e094f29ef3e7f7af3b0a20047b67a70c8c3e18..13f0502b9e0bca9e4119896c01786b99cc54441e 100644 (file)
@@ -334,7 +334,9 @@ static int check_header(char *line, unsigned linesize, char **hdr_data, int over
                return 1;
        if (!memcmp("[PATCH]", line, 7) && isspace(line[7])) {
                for (i = 0; header[i]; i++) {
-                       if (!memcmp("Subject: ", header[i], 9)) {
+                       if (!memcmp("Subject", header[i], 7)) {
+                               if (!hdr_data[i])
+                                       hdr_data[i] = xmalloc(linesize + 20);
                                if (! handle_header(line, hdr_data[i], 0)) {
                                        return 1;
                                }
@@ -812,6 +814,7 @@ static void handle_body(void)
                                              np - newline);
                        if (!handle_boundary())
                                return;
+                       len = strlen(line);
                }
 
                /* Unwrap transfer encoding */
@@ -959,7 +962,7 @@ static int mailinfo(FILE *in, FILE *out, int ks, const char *encoding,
 }
 
 static const char mailinfo_usage[] =
-       "git-mailinfo [-k] [-u | --encoding=<encoding>] msg patch <mail >info";
+       "git-mailinfo [-k] [-u | --encoding=<encoding> | -n] msg patch <mail >info";
 
 int cmd_mailinfo(int argc, const char **argv, const char *prefix)
 {
@@ -968,7 +971,7 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix)
        /* NEEDSWORK: might want to do the optional .git/ directory
         * discovery
         */
-       git_config(git_default_config);
+       git_config(git_default_config, NULL);
 
        def_charset = (git_commit_encoding ? git_commit_encoding : "utf-8");
        metainfo_charset = def_charset;