@matheusbsbs / matheus-bagliano / commits / d54276f207
Fork 0

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: Junio C Hamano <gitster@pobox.com>

Alex Riesen committed Jul 4, 2007 at 12:37 UTC d54276f207081e35174c5d742e378cfff6e9843f
1 file changed +8 -7
builtin-log.c
+8 -7
@@ -16,6 +16,7 @@
16 #include "refs.h"
17
18 static int default_show_root = 1;
19 +static const char *fmt_patch_subject_prefix = "PATCH";
20
21 /* this is in builtin-diff.c */
22 void add_head(struct rev_info *revs);
@@ -55,6 +56,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
56 rev->commit_format = CMIT_FMT_DEFAULT;
57 rev->verbose_header = 1;
58 rev->show_root_diff = default_show_root;
59 + rev->subject_prefix = fmt_patch_subject_prefix;
60 argc = setup_revisions(argc, argv, rev, "HEAD");
61 if (rev->diffopt.pickaxe || rev->diffopt.filter)
62 rev->always_show_header = 0;
@@ -94,6 +96,12 @@ static int cmd_log_walk(struct rev_info *rev)
96
97 static int git_log_config(const char *var, const char *value)
98 {
99 + if (!strcmp(var, "format.subjectprefix")) {
100 + if (!value)
101 + die("format.subjectprefix without value");
102 + fmt_patch_subject_prefix = xstrdup(value);
103 + return 0;
104 + }
105 if (!strcmp(var, "log.showroot")) {
106 default_show_root = git_config_bool(var, value);
107 return 0;
@@ -265,7 +273,6 @@ static int istitlechar(char c)
273
274 static char *extra_headers = NULL;
275 static int extra_headers_size = 0;
268 -static const char *fmt_patch_subject_prefix = "PATCH";
276 static const char *fmt_patch_suffix = ".patch";
277
278 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)
298 if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) {
299 return 0;
300 }
294 - if (!strcmp(var, "format.subjectprefix")) {
295 - if (!value)
296 - die("format.subjectprefix without value");
297 - fmt_patch_subject_prefix = xstrdup(value);
298 - return 0;
299 - }
301
302 return git_log_config(var, value);
303 }