提交 d54276f2 编写于 作者: A Alex Riesen 提交者: Junio C Hamano

Handle format.subjectprefix for every command which accepts --pretty

Because the --pretty can be given as --pretty=email which historically produced
mails with patches. IOW, exactly what git-format-patch does.
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 88c447e8
......@@ -16,6 +16,7 @@
#include "refs.h"
static int default_show_root = 1;
static const char *fmt_patch_subject_prefix = "PATCH";
/* this is in builtin-diff.c */
void add_head(struct rev_info *revs);
......@@ -55,6 +56,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
rev->commit_format = CMIT_FMT_DEFAULT;
rev->verbose_header = 1;
rev->show_root_diff = default_show_root;
rev->subject_prefix = fmt_patch_subject_prefix;
argc = setup_revisions(argc, argv, rev, "HEAD");
if (rev->diffopt.pickaxe || rev->diffopt.filter)
rev->always_show_header = 0;
......@@ -94,6 +96,12 @@ static int cmd_log_walk(struct rev_info *rev)
static int git_log_config(const char *var, const char *value)
{
if (!strcmp(var, "format.subjectprefix")) {
if (!value)
die("format.subjectprefix without value");
fmt_patch_subject_prefix = xstrdup(value);
return 0;
}
if (!strcmp(var, "log.showroot")) {
default_show_root = git_config_bool(var, value);
return 0;
......@@ -265,7 +273,6 @@ static int istitlechar(char c)
static char *extra_headers = NULL;
static int extra_headers_size = 0;
static const char *fmt_patch_subject_prefix = "PATCH";
static const char *fmt_patch_suffix = ".patch";
static int git_format_config(const char *var, const char *value)
......@@ -291,12 +298,6 @@ static int git_format_config(const char *var, const char *value)
if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) {
return 0;
}
if (!strcmp(var, "format.subjectprefix")) {
if (!value)
die("format.subjectprefix without value");
fmt_patch_subject_prefix = xstrdup(value);
return 0;
}
return git_log_config(var, value);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册