format-patch -s: add MIME encoding header if signer's name requires so · wolfpython/git@4593fb8 · GitHub
Skip to content

Commit 4593fb8

Browse files
committed
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>
1 parent 3e4bb08 commit 4593fb8

7 files changed

Lines changed: 24 additions & 9 deletions

File tree

builtin-branch.c

Lines changed: 1 addition & 1 deletion

builtin-log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
787787
struct strbuf buf;
788788
strbuf_init(&buf, 0);
789789
pretty_print_commit(CMIT_FMT_ONELINE, commit,
790-
&buf, 0, NULL, NULL, 0);
790+
&buf, 0, NULL, NULL, 0, 0);
791791
printf("%c %s %s\n", sign,
792792
sha1_to_hex(commit->object.sha1), buf.buf);
793793
strbuf_release(&buf);

builtin-rev-list.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ static void show_commit(struct commit *commit)
8686
struct strbuf buf;
8787
strbuf_init(&buf, 0);
8888
pretty_print_commit(revs.commit_format, commit,
89-
&buf, revs.abbrev, NULL, NULL, revs.date_mode);
89+
&buf, revs.abbrev, NULL, NULL,
90+
revs.date_mode, 0);
9091
if (buf.len)
9192
printf("%s%c", buf.buf, hdr_termination);
9293
strbuf_release(&buf);

builtin-show-branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static void show_one_commit(struct commit *commit, int no_name)
266266
strbuf_init(&pretty, 0);
267267
if (commit->object.parsed) {
268268
pretty_print_commit(CMIT_FMT_ONELINE, commit,
269-
&pretty, 0, NULL, NULL, 0);
269+
&pretty, 0, NULL, NULL, 0, 0);
270270
pretty_str = pretty.buf;
271271
}
272272
if (!prefixcmp(pretty_str, "[PATCH] "))

commit.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ static int get_one_line(const char *msg)
479479
}
480480

481481
/* High bit set, or ISO-2022-INT */
482-
static int non_ascii(int ch)
482+
int non_ascii(int ch)
483483
{
484484
ch = (ch & 0xff);
485485
return ((ch & 0x80) || (ch == 0x1b));
@@ -1046,12 +1046,11 @@ static void pp_remainder(enum cmit_fmt fmt,
10461046
void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
10471047
struct strbuf *sb, int abbrev,
10481048
const char *subject, const char *after_subject,
1049-
enum date_mode dmode)
1049+
enum date_mode dmode, int plain_non_ascii)
10501050
{
10511051
unsigned long beginning_of_body;
10521052
int indent = 4;
10531053
const char *msg = commit->buffer;
1054-
int plain_non_ascii = 0;
10551054
char *reencoded;
10561055
const char *encoding;
10571056

commit.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ enum cmit_fmt {
6161
CMIT_FMT_UNSPECIFIED,
6262
};
6363

64+
extern int non_ascii(int);
6465
extern enum cmit_fmt get_commit_format(const char *arg);
6566
extern void format_commit_message(const struct commit *commit,
6667
const void *format, struct strbuf *sb);
6768
extern void pretty_print_commit(enum cmit_fmt fmt, const struct commit*,
6869
struct strbuf *,
6970
int abbrev, const char *subject,
70-
const char *after_subject, enum date_mode);
71+
const char *after_subject, enum date_mode,
72+
int non_ascii_present);
7173

7274
/** Removes the first commit from a list sorted by date, and adds all
7375
* of its parents.

log-tree.c

Lines changed: 14 additions & 1 deletion

0 commit comments

Comments
 (0)