summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6d0618a)
raw | patch | inline | side by side (parent: 6d0618a)
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> | |
Thu, 8 Nov 2007 02:37:27 +0000 (18:37 -0800) |
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.
This was cherry-picked from the fix in 'master'
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.
This was cherry-picked from the fix in 'master'
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 5f5c1823cb27cf1173c87f43bd0d2de95a06bf46..c1e9a61ea5642786b9e71fe437853a8ccc532b09 100644 (file)
--- a/builtin-branch.c
+++ b/builtin-branch.c
if (commit && !parse_commit(commit)) {
pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0,
&subject, &subject_len, 0,
- NULL, NULL, 0);
+ NULL, NULL, 0, 0);
sub = subject;
}
printf("%c %s%-*s%s %s %s\n", c, branch_get_color(color),
diff --git a/builtin-log.c b/builtin-log.c
index c6cc3aef5270fe64821146376354239d54de5a26..070886ae578257c65d5716d608b61eacd5a535f2 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
char *buf = NULL;
unsigned long buflen = 0;
pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0,
- &buf, &buflen, 0, NULL, NULL, 0);
+ &buf, &buflen, 0, NULL, NULL, 0, 0);
printf("%c %s %s\n", sign,
sha1_to_hex(commit->object.sha1), buf);
free(buf);
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index ac551d59f3f6cb209a645ad708c46e4e88791295..9dbfae416c2ed563960e69cc6286891d37d576e0 100644 (file)
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
unsigned long buflen = 0;
pretty_print_commit(revs.commit_format, commit, ~0,
&buf, &buflen,
- revs.abbrev, NULL, NULL, revs.date_mode);
+ revs.abbrev, NULL, NULL, revs.date_mode, 0);
printf("%s%c", buf, hdr_termination);
free(buf);
}
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 4fa87f6081f74fa667a415038ca64c5f4a7cf775..b9cf1b379f60d42408eb75009e57030173448d8c 100644 (file)
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
if (commit->object.parsed) {
pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0,
&pretty, &pretty_len,
- 0, NULL, NULL, 0);
+ 0, NULL, NULL, 0, 0);
pretty_str = pretty;
}
if (!prefixcmp(pretty_str, "[PATCH] "))
diff --git a/commit.c b/commit.c
index 1fbdd2d51b8e798ac73c4b020f8fa47b1d6fb168..10f7b14e763feab4b86d3a8fb1f011cb918312c8 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));
char **buf_p, unsigned long *space_p,
int abbrev, const char *subject,
const char *after_subject,
- enum date_mode dmode)
+ enum date_mode dmode,
+ int plain_non_ascii)
{
unsigned long offset = 0;
unsigned long beginning_of_body;
int indent = 4;
const char *msg = commit->buffer;
- int plain_non_ascii = 0;
char *reencoded;
const char *encoding;
char *buf;
diff --git a/commit.h b/commit.h
index 467872eecabf05ccedbb9bf8247b6de244416b8f..b897b5730d9b9c220362b0b6a9df7be5d6803df3 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 unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char **buf_p, unsigned long *space_p, int abbrev, const char *subject, const char *after_subject, enum date_mode dmode);
+extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char **buf_p, unsigned long *space_p, int abbrev, const char *subject, const char *after_subject, enum date_mode dmode, 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 b509c0c7ec239d4f426807406d94c34feeecf009..9ebc24b68754a422a53270028b032395ad7c754a 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)
{
char *msgbuf = NULL;
*/
len = pretty_print_commit(opt->commit_format, commit, ~0u,
&msgbuf, &msgbuf_len, abbrev, subject,
- extra_headers, opt->date_mode);
+ extra_headers, opt->date_mode,
+ has_non_ascii(opt->add_signoff));
if (opt->add_signoff)
len = append_signoff(&msgbuf, &msgbuf_len, len,