summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3e4bb08)
raw | patch | inline | side by side (parent: 3e4bb08)
author | Junio C Hamano <gitster@pobox.com> | |
Wed, 31 Oct 2007 21:55:17 +0000 (14:55 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 2 Nov 2007 00:18:39 +0000 (17:18 -0700) |
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>
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>
builtin-branch.c | patch | blob | history | |
builtin-log.c | patch | blob | history | |
builtin-rev-list.c | patch | blob | history | |
builtin-show-branch.c | patch | blob | history | |
commit.c | patch | blob | history | |
commit.h | patch | blob | history | |
log-tree.c | patch | blob | history |
diff --git a/builtin-branch.c b/builtin-branch.c
index 3da8b55b8f49c52794d337a026a4f5a5ae727b24..3e020ccf17bc88da1ff5d5947d38c6d70c67668c 100644 (file)
--- a/builtin-branch.c
+++ b/builtin-branch.c
commit = lookup_commit(item->sha1);
if (commit && !parse_commit(commit)) {
pretty_print_commit(CMIT_FMT_ONELINE, commit,
- &subject, 0, NULL, NULL, 0);
+ &subject, 0, NULL, NULL, 0, 0);
sub = subject.buf;
}
printf("%c %s%-*s%s %s %s\n", c, branch_get_color(color),
diff --git a/builtin-log.c b/builtin-log.c
index e8b982db7cf7c98bff9d64affcb573b3d9676cb1..8b2bf632c534c5a9b5295884e517d70c7d2d9e86 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
struct strbuf buf;
strbuf_init(&buf, 0);
pretty_print_commit(CMIT_FMT_ONELINE, commit,
- &buf, 0, NULL, NULL, 0);
+ &buf, 0, NULL, NULL, 0, 0);
printf("%c %s %s\n", sign,
sha1_to_hex(commit->object.sha1), buf.buf);
strbuf_release(&buf);
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 44393320e8ec27a35ccc1da550852ce3333a25a8..697046723fc64f38ab4fb589c84f1c5d5934894a 100644 (file)
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
struct strbuf buf;
strbuf_init(&buf, 0);
pretty_print_commit(revs.commit_format, commit,
- &buf, revs.abbrev, NULL, NULL, revs.date_mode);
+ &buf, revs.abbrev, NULL, NULL,
+ revs.date_mode, 0);
if (buf.len)
printf("%s%c", buf.buf, hdr_termination);
strbuf_release(&buf);
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 07a0c2316bec4dd8341ea494b02874a1b12483cd..6dc835d30a6a726c3dd40d23564b0dc32d20b7db 100644 (file)
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
strbuf_init(&pretty, 0);
if (commit->object.parsed) {
pretty_print_commit(CMIT_FMT_ONELINE, commit,
- &pretty, 0, NULL, NULL, 0);
+ &pretty, 0, NULL, NULL, 0, 0);
pretty_str = pretty.buf;
}
if (!prefixcmp(pretty_str, "[PATCH] "))
diff --git a/commit.c b/commit.c
index ac24266e935054c6909b8fbd513ffa937e2ae092..8262f6ac58c3bf738c144d6a868bdd29633241e7 100644 (file)
--- a/commit.c
+++ b/commit.c
}
/* High bit set, or ISO-2022-INT */
-static int non_ascii(int ch)
+int non_ascii(int ch)
{
ch = (ch & 0xff);
return ((ch & 0x80) || (ch == 0x1b));
void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
struct strbuf *sb, int abbrev,
const char *subject, const char *after_subject,
- enum date_mode dmode)
+ enum date_mode dmode, int plain_non_ascii)
{
unsigned long beginning_of_body;
int indent = 4;
const char *msg = commit->buffer;
- int plain_non_ascii = 0;
char *reencoded;
const char *encoding;
diff --git a/commit.h b/commit.h
index b661503972e54a6c0eb20295cf982f8f8b48f461..13b537293df97ae503b993aeba15edc2dac09e2a 100644 (file)
--- a/commit.h
+++ b/commit.h
CMIT_FMT_UNSPECIFIED,
};
+extern int non_ascii(int);
extern enum cmit_fmt get_commit_format(const char *arg);
extern void format_commit_message(const struct commit *commit,
const void *format, struct strbuf *sb);
extern void pretty_print_commit(enum cmit_fmt fmt, const struct commit*,
struct strbuf *,
int abbrev, const char *subject,
- const char *after_subject, enum date_mode);
+ const char *after_subject, enum date_mode,
+ int non_ascii_present);
/** Removes the first commit from a list sorted by date, and adds all
* of its parents.
diff --git a/log-tree.c b/log-tree.c
index 3763ce94fcb5c96f366f84e755c8abd725b00b00..a34beb0b027eaec59fa75d1fa18324a8f24eb13d 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
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;
*/
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);