Commits

Anonymous committed 1d2a7e0 Merge

Merge branch 'js/maint-cover-letter-non-ascii' into maint

* js/maint-cover-letter-non-ascii:
Correctly mark cover letters' encodings if they are not pure ASCII
Expose the has_non_ascii() function

  • Participants
  • Parent commits b813234, 0a7f448

Comments (0)

Files changed (4)

File builtin-log.c

 	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);
 };
 
 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);
 	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)
 {
 	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 == '_'));