diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-08-16 04:13:18 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-08-16 04:13:18 -0700 |
commit | 228f9c9a9f66ca9c5b9adb2d2bffc19de25a8d85 (patch) | |
tree | cee1dddcf4af2135fbd6b8f8389523374f9f088b | |
parent | Merge branch 'jc/maint-clean-nested-dir-safety' (diff) | |
parent | Correctly mark cover letters' encodings if they are not pure ASCII (diff) | |
download | tgif-228f9c9a9f66ca9c5b9adb2d2bffc19de25a8d85.tar.xz |
Merge branch 'js/maint-cover-letter-non-ascii'
* js/maint-cover-letter-non-ascii:
Correctly mark cover letters' encodings if they are not pure ASCII
Expose the has_non_ascii() function
-rw-r--r-- | builtin-log.c | 4 | ||||
-rw-r--r-- | commit.h | 1 | ||||
-rw-r--r-- | log-tree.c | 12 | ||||
-rw-r--r-- | pretty.c | 12 |
4 files changed, 17 insertions, 12 deletions
diff --git a/builtin-log.c b/builtin-log.c index 3817bf1186..82236c531b 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -670,6 +670,10 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, log_write_email_headers(rev, head, &subject_start, &extra_headers, &need_8bit_cte); + for (i = 0; !need_8bit_cte && i < nr; i++) + if (has_non_ascii(list[i]->buffer)) + need_8bit_cte = 1; + msg = body; pp_user_info(NULL, CMIT_FMT_EMAIL, &sb, committer, DATE_RFC2822, encoding); @@ -64,6 +64,7 @@ enum cmit_fmt { }; extern int non_ascii(int); +extern int has_non_ascii(const char *text); struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */ extern char *reencode_commit_message(const struct commit *commit, const char **encoding_p); diff --git a/log-tree.c b/log-tree.c index 6f73c17d74..a3b4c0692c 100644 --- a/log-tree.c +++ b/log-tree.c @@ -168,18 +168,6 @@ static unsigned int digits_in_number(unsigned int number) return result; } -static int has_non_ascii(const char *s) -{ - int ch; - if (!s) - return 0; - while ((ch = *s++) != '\0') { - if (non_ascii(ch)) - return 1; - } - return 0; -} - void get_patch_filename(struct commit *commit, int nr, const char *suffix, struct strbuf *buf) { @@ -86,6 +86,18 @@ int non_ascii(int ch) return !isascii(ch) || ch == '\033'; } +int has_non_ascii(const char *s) +{ + int ch; + if (!s) + return 0; + while ((ch = *s++) != '\0') { + if (non_ascii(ch)) + return 1; + } + return 0; +} + static int is_rfc2047_special(char ch) { return (non_ascii(ch) || (ch == '=') || (ch == '?') || (ch == '_')); |