Code

Document merge.branchdesc configuration variable
[git.git] / builtin / mailinfo.c
index a50ac2256cdbacd76ed44a50804212be07f949db..bfb32b7233850a68bdc226038a9c0f973037499b 100644 (file)
@@ -17,10 +17,10 @@ static struct strbuf name = STRBUF_INIT;
 static struct strbuf email = STRBUF_INIT;
 
 static enum  {
-       TE_DONTCARE, TE_QP, TE_BASE64,
+       TE_DONTCARE, TE_QP, TE_BASE64
 } transfer_encoding;
 static enum  {
-       TYPE_TEXT, TYPE_OTHER,
+       TYPE_TEXT, TYPE_OTHER
 } message_type;
 
 static struct strbuf charset = STRBUF_INIT;
@@ -400,7 +400,7 @@ static int read_one_header_line(struct strbuf *line, FILE *in)
                        break;
                if (strbuf_getline(&continuation, in, '\n'))
                        break;
-               continuation.buf[0] = '\n';
+               continuation.buf[0] = ' ';
                strbuf_rtrim(&continuation);
                strbuf_addbuf(line, &continuation);
        }
@@ -746,7 +746,8 @@ static int is_scissors_line(const struct strbuf *line)
                        continue;
                }
                if (i + 1 < len &&
-                   (!memcmp(buf + i, ">8", 2) || !memcmp(buf + i, "8<", 2))) {
+                   (!memcmp(buf + i, ">8", 2) || !memcmp(buf + i, "8<", 2) ||
+                    !memcmp(buf + i, ">%", 2) || !memcmp(buf + i, "%<", 2))) {
                        in_perforation = 1;
                        perforation += 2;
                        scissors += 2;
@@ -779,8 +780,7 @@ static int handle_commit_msg(struct strbuf *line)
                return 0;
 
        if (still_looking) {
-               strbuf_ltrim(line);
-               if (!line->len)
+               if (!line->len || (line->len == 1 && line->buf[0] == '\n'))
                        return 0;
        }
 
@@ -1032,7 +1032,7 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix)
         */
        git_config(git_mailinfo_config, NULL);
 
-       def_charset = (git_commit_encoding ? git_commit_encoding : "UTF-8");
+       def_charset = get_commit_output_encoding();
        metainfo_charset = def_charset;
 
        while (1 < argc && argv[1][0] == '-') {