* [PATCH 0/2] Fix cover letters when they contain non-ASCII
@ 2009-08-10 16:22 Johannes Schindelin
2009-08-10 16:22 ` [PATCH 1/2] Expose the has_non_ascii() function Johannes Schindelin
2009-08-10 16:22 ` [PATCH 2/2] Correctly mark cover letters' encodings if they are not pure ASCII Johannes Schindelin
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Schindelin @ 2009-08-10 16:22 UTC (permalink / raw)
To: git, gitster
[-- Attachment #1: Type: TEXT/PLAIN, Size: 368 bytes --]
Hi,
I saw this issue with Santi's and Nguyễn's patch series.
Johannes Schindelin (2):
Expose the has_non_ascii() function
Correctly mark cover letters' encodings if they are not pure ASCII
builtin-log.c | 4 ++++
commit.h | 1 +
log-tree.c | 12 ------------
pretty.c | 12 ++++++++++++
4 files changed, 17 insertions(+), 12 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] Expose the has_non_ascii() function
2009-08-10 16:22 [PATCH 0/2] Fix cover letters when they contain non-ASCII Johannes Schindelin
@ 2009-08-10 16:22 ` Johannes Schindelin
2009-08-10 16:22 ` [PATCH 2/2] Correctly mark cover letters' encodings if they are not pure ASCII Johannes Schindelin
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2009-08-10 16:22 UTC (permalink / raw)
To: git, gitster
This function is useful outside of log-tree.c, too.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
commit.h | 1 +
log-tree.c | 12 ------------
pretty.c | 12 ++++++++++++
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/commit.h b/commit.h
index 8bfdf0e..d1674d7 100644
--- a/commit.h
+++ b/commit.h
@@ -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 6f73c17..a3b4c06 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)
{
diff --git a/pretty.c b/pretty.c
index 1aa9c3f..ec0affe 100644
--- a/pretty.c
+++ b/pretty.c
@@ -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 == '_'));
--
1.6.3.2.734.g770e
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] Correctly mark cover letters' encodings if they are not pure ASCII
2009-08-10 16:22 [PATCH 0/2] Fix cover letters when they contain non-ASCII Johannes Schindelin
2009-08-10 16:22 ` [PATCH 1/2] Expose the has_non_ascii() function Johannes Schindelin
@ 2009-08-10 16:22 ` Johannes Schindelin
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2009-08-10 16:22 UTC (permalink / raw)
To: git, gitster
[-- Attachment #1: Type: TEXT/PLAIN, Size: 792 bytes --]
If your name is, say, Üwë, you want your cover letters to appear
correctly. Convince format-patch to mark it as 8-bit.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin-log.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 3600215..d4a6a7d 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -678,6 +678,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);
--
1.6.3.2.734.g770e
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-10 16:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-10 16:22 [PATCH 0/2] Fix cover letters when they contain non-ASCII Johannes Schindelin
2009-08-10 16:22 ` [PATCH 1/2] Expose the has_non_ascii() function Johannes Schindelin
2009-08-10 16:22 ` [PATCH 2/2] Correctly mark cover letters' encodings if they are not pure ASCII Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).