···94 Set a custom directory to store the resulting files instead of the
95 current working directory. All directory components will be created.
960000097format.useAutoBase::
98 A boolean value which lets you enable the `--base=auto` option of
99 format-patch by default. Can also be set to "whenAble" to allow
···94 Set a custom directory to store the resulting files instead of the
95 current working directory. All directory components will be created.
9697+format.filenameMaxLength::
98+ The maximum length of the output filenames generated by the
99+ `format-patch` command; defaults to 64. Can be overridden
100+ by the `--filename-max-length=<n>` command line option.
101+102format.useAutoBase::
103 A boolean value which lets you enable the `--base=auto` option of
104 format-patch by default. Can also be set to "whenAble" to allow
+8
Documentation/git-format-patch.txt
···28 [--no-notes | --notes[=<ref>]]
29 [--interdiff=<previous>]
30 [--range-diff=<previous> [--creation-factor=<percent>]]
031 [--progress]
32 [<common diff options>]
33 [ <since> | <revision range> ]
···199 line, instead use '[<subject prefix>]'. This
200 allows for useful naming of a patch series, and can be
201 combined with the `--numbered` option.
0000000202203--rfc::
204 Alias for `--subject-prefix="RFC PATCH"`. RFC means "Request For
···28 [--no-notes | --notes[=<ref>]]
29 [--interdiff=<previous>]
30 [--range-diff=<previous> [--creation-factor=<percent>]]
31+ [--filename-max-length=<n>]
32 [--progress]
33 [<common diff options>]
34 [ <since> | <revision range> ]
···200 line, instead use '[<subject prefix>]'. This
201 allows for useful naming of a patch series, and can be
202 combined with the `--numbered` option.
203+204+--filename-max-length=<n>::
205+ Instead of the standard 64 bytes, chomp the generated output
206+ filenames at around '<n>' bytes (too short a value will be
207+ silently raised to a reasonable length). Defaults to the
208+ value of the `format.filenameMaxLength` configuration
209+ variable, or 64 if unconfigured.
210211--rfc::
212 Alias for `--subject-prefix="RFC PATCH"`. RFC means "Request For
+14-6
builtin/log.c
···3738#define MAIL_DEFAULT_WRAP 72
39#define COVER_FROM_AUTO_MAX_SUBJECT_LEN 100
04041/* Set a default date-time format for git log ("log.date" config variable) */
42static const char *default_date_mode = NULL;
···50static int decoration_given;
51static int use_mailmap_config = 1;
52static const char *fmt_patch_subject_prefix = "PATCH";
053static const char *fmt_pretty;
5455static const char * const builtin_log_usage[] = {
···150 rev->abbrev_commit = default_abbrev_commit;
151 rev->show_root_diff = default_show_root;
152 rev->subject_prefix = fmt_patch_subject_prefix;
0153 rev->show_signature = default_show_signature;
154 rev->encode_email_headers = default_encode_email_headers;
155 rev->diffopt.flags.allow_textconv = 1;
···457 return git_config_string(&fmt_pretty, var, value);
458 if (!strcmp(var, "format.subjectprefix"))
459 return git_config_string(&fmt_patch_subject_prefix, var, value);
0000460 if (!strcmp(var, "format.encodeemailheaders")) {
461 default_encode_email_headers = git_config_bool(var, value);
462 return 0;
···958 struct rev_info *rev, int quiet)
959{
960 struct strbuf filename = STRBUF_INIT;
961- int suffix_len = strlen(rev->patch_suffix) + 1;
962963 if (output_directory) {
964 strbuf_addstr(&filename, output_directory);
965- if (filename.len >=
966- PATH_MAX - FORMAT_PATCH_NAME_MAX - suffix_len) {
967- strbuf_release(&filename);
968- return error(_("name of output directory is too long"));
969- }
970 strbuf_complete(&filename, '/');
971 }
972···1754 N_("start numbering patches at <n> instead of 1")),
1755 OPT_INTEGER('v', "reroll-count", &reroll_count,
1756 N_("mark the series as Nth re-roll")),
001757 OPT_CALLBACK_F(0, "rfc", &rev, NULL,
1758 N_("Use [RFC PATCH] instead of [PATCH]"),
1759 PARSE_OPT_NOARG | PARSE_OPT_NONEG, rfc_callback),
···1854 PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN |
1855 PARSE_OPT_KEEP_DASHDASH);
185600001857 if (cover_from_description_arg)
1858 cover_from_description_mode = parse_cover_from_description(cover_from_description_arg);
1859···1938 rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
19391940 rev.zero_commit = zero_commit;
019411942 if (!rev.diffopt.flags.text && !no_binary_diff)
1943 rev.diffopt.flags.binary = 1;
···3738#define MAIL_DEFAULT_WRAP 72
39#define COVER_FROM_AUTO_MAX_SUBJECT_LEN 100
40+#define FORMAT_PATCH_NAME_MAX_DEFAULT 64
4142/* Set a default date-time format for git log ("log.date" config variable) */
43static const char *default_date_mode = NULL;
···51static int decoration_given;
52static int use_mailmap_config = 1;
53static const char *fmt_patch_subject_prefix = "PATCH";
54+static int fmt_patch_name_max = FORMAT_PATCH_NAME_MAX_DEFAULT;
55static const char *fmt_pretty;
5657static const char * const builtin_log_usage[] = {
···152 rev->abbrev_commit = default_abbrev_commit;
153 rev->show_root_diff = default_show_root;
154 rev->subject_prefix = fmt_patch_subject_prefix;
155+ rev->patch_name_max = fmt_patch_name_max;
156 rev->show_signature = default_show_signature;
157 rev->encode_email_headers = default_encode_email_headers;
158 rev->diffopt.flags.allow_textconv = 1;
···460 return git_config_string(&fmt_pretty, var, value);
461 if (!strcmp(var, "format.subjectprefix"))
462 return git_config_string(&fmt_patch_subject_prefix, var, value);
463+ if (!strcmp(var, "format.filenamemaxlength")) {
464+ fmt_patch_name_max = git_config_int(var, value);
465+ return 0;
466+ }
467 if (!strcmp(var, "format.encodeemailheaders")) {
468 default_encode_email_headers = git_config_bool(var, value);
469 return 0;
···965 struct rev_info *rev, int quiet)
966{
967 struct strbuf filename = STRBUF_INIT;
0968969 if (output_directory) {
970 strbuf_addstr(&filename, output_directory);
00000971 strbuf_complete(&filename, '/');
972 }
973···1755 N_("start numbering patches at <n> instead of 1")),
1756 OPT_INTEGER('v', "reroll-count", &reroll_count,
1757 N_("mark the series as Nth re-roll")),
1758+ OPT_INTEGER(0, "filename-max-length", &fmt_patch_name_max,
1759+ N_("max length of output filename")),
1760 OPT_CALLBACK_F(0, "rfc", &rev, NULL,
1761 N_("Use [RFC PATCH] instead of [PATCH]"),
1762 PARSE_OPT_NOARG | PARSE_OPT_NONEG, rfc_callback),
···1857 PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN |
1858 PARSE_OPT_KEEP_DASHDASH);
18591860+ /* Make sure "0000-$sub.patch" gives non-negative length for $sub */
1861+ if (fmt_patch_name_max <= strlen("0000-") + strlen(fmt_patch_suffix))
1862+ fmt_patch_name_max = strlen("0000-") + strlen(fmt_patch_suffix);
1863+1864 if (cover_from_description_arg)
1865 cover_from_description_mode = parse_cover_from_description(cover_from_description_arg);
1866···1945 rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
19461947 rev.zero_commit = zero_commit;
1948+ rev.patch_name_max = fmt_patch_name_max;
19491950 if (!rev.diffopt.flags.text && !no_binary_diff)
1951 rev.diffopt.flags.binary = 1;
+1-1
log-tree.c
···367 const char *suffix = info->patch_suffix;
368 int nr = info->nr;
369 int start_len = filename->len;
370- int max_len = start_len + FORMAT_PATCH_NAME_MAX - (strlen(suffix) + 1);
371372 if (0 < info->reroll_count)
373 strbuf_addf(filename, "v%d-", info->reroll_count);
···367 const char *suffix = info->patch_suffix;
368 int nr = info->nr;
369 int start_len = filename->len;
370+ int max_len = start_len + info->patch_name_max - (strlen(suffix) + 1);
371372 if (0 < info->reroll_count)
373 strbuf_addf(filename, "v%d-", info->reroll_count);