format-patch: teach --no-encode-email-headers
When commit subjects or authors have non-ASCII characters, git format-patch Q-encodes them so they can be safely sent over email. However, if the patch transfer method is something other than email (web review tools, sneakernet), this only serves to make the patch metadata harder to read without first applying it (unless you can decode RFC 2047 in your head). git am as well as some email software supports non-Q-encoded mail as described in RFC 6531. Add --[no-]encode-email-headers and format.encodeEmailHeaders to let the user control this behavior. Signed-off-by: Emma Brooks <me@pluvano.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
9fadedd637
commit
19d097e3d7
@ -46,6 +46,7 @@ static int default_abbrev_commit;
|
||||
static int default_show_root = 1;
|
||||
static int default_follow;
|
||||
static int default_show_signature;
|
||||
static int default_encode_email_headers = 1;
|
||||
static int decoration_style;
|
||||
static int decoration_given;
|
||||
static int use_mailmap_config = 1;
|
||||
@ -151,6 +152,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)
|
||||
rev->show_root_diff = default_show_root;
|
||||
rev->subject_prefix = fmt_patch_subject_prefix;
|
||||
rev->show_signature = default_show_signature;
|
||||
rev->encode_email_headers = default_encode_email_headers;
|
||||
rev->diffopt.flags.allow_textconv = 1;
|
||||
|
||||
if (default_date_mode)
|
||||
@ -438,6 +440,10 @@ static int git_log_config(const char *var, const char *value, void *cb)
|
||||
return git_config_string(&fmt_pretty, var, value);
|
||||
if (!strcmp(var, "format.subjectprefix"))
|
||||
return git_config_string(&fmt_patch_subject_prefix, var, value);
|
||||
if (!strcmp(var, "format.encodeemailheaders")) {
|
||||
default_encode_email_headers = git_config_bool(var, value);
|
||||
return 0;
|
||||
}
|
||||
if (!strcmp(var, "log.abbrevcommit")) {
|
||||
default_abbrev_commit = git_config_bool(var, value);
|
||||
return 0;
|
||||
@ -1719,6 +1725,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
rev.show_notes = show_notes;
|
||||
memcpy(&rev.notes_opt, ¬es_opt, sizeof(notes_opt));
|
||||
rev.commit_format = CMIT_FMT_EMAIL;
|
||||
rev.encode_email_headers = default_encode_email_headers;
|
||||
rev.expand_tabs_in_log_default = 0;
|
||||
rev.verbose_header = 1;
|
||||
rev.diff = 1;
|
||||
|
||||
Reference in New Issue
Block a user