aboutsummaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-10-31 14:55:17 -0700
committerJunio C Hamano <gitster@pobox.com>2007-11-01 17:18:39 -0700
commit4593fb84051d39f65cec81958e91056986e4682f (patch)
tree1578c05838433c52285292a762077317d86fee95 /log-tree.c
parent3e4bb087a18435b12eb82116e93af2887578e816 (diff)
downloadgit-4593fb84051d39f65cec81958e91056986e4682f.tar.gz
git-4593fb84051d39f65cec81958e91056986e4682f.tar.xz
format-patch -s: add MIME encoding header if signer's name requires so
When the body of the commit log message contains a non-ASCII character, format-patch correctly emitted the encoding header to mark the resulting message as such. However, if the original message was fully ASCII, the command line switch "-s" was given to add a new sign-off, and the signer's name was not ASCII only, the resulting message would have contained non-ASCII character but was not marked as such. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/log-tree.c b/log-tree.c
index 3763ce94f..a34beb0b0 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -125,6 +125,18 @@ 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 show_log(struct rev_info *opt, const char *sep)
{
struct strbuf msgbuf;
@@ -273,7 +285,8 @@ void show_log(struct rev_info *opt, const char *sep)
*/
strbuf_init(&msgbuf, 0);
pretty_print_commit(opt->commit_format, commit, &msgbuf,
- abbrev, subject, extra_headers, opt->date_mode);
+ abbrev, subject, extra_headers, opt->date_mode,
+ has_non_ascii(opt->add_signoff));
if (opt->add_signoff)
append_signoff(&msgbuf, opt->add_signoff);