···9494 Set a custom directory to store the resulting files instead of the
9595 current working directory. All directory components will be created.
96969797+format.filenameMaxLength::
9898+ The maximum length of the output filenames generated by the
9999+ `format-patch` command; defaults to 64. Can be overridden
100100+ by the `--filename-max-length=<n>` command line option.
101101+97102format.useAutoBase::
98103 A boolean value which lets you enable the `--base=auto` option of
99104 format-patch by default. Can also be set to "whenAble" to allow
+8
Documentation/git-format-patch.txt
···2828 [--no-notes | --notes[=<ref>]]
2929 [--interdiff=<previous>]
3030 [--range-diff=<previous> [--creation-factor=<percent>]]
3131+ [--filename-max-length=<n>]
3132 [--progress]
3233 [<common diff options>]
3334 [ <since> | <revision range> ]
···199200 line, instead use '[<subject prefix>]'. This
200201 allows for useful naming of a patch series, and can be
201202 combined with the `--numbered` option.
203203+204204+--filename-max-length=<n>::
205205+ Instead of the standard 64 bytes, chomp the generated output
206206+ filenames at around '<n>' bytes (too short a value will be
207207+ silently raised to a reasonable length). Defaults to the
208208+ value of the `format.filenameMaxLength` configuration
209209+ variable, or 64 if unconfigured.
202210203211--rfc::
204212 Alias for `--subject-prefix="RFC PATCH"`. RFC means "Request For
+14-6
builtin/log.c
···37373838#define MAIL_DEFAULT_WRAP 72
3939#define COVER_FROM_AUTO_MAX_SUBJECT_LEN 100
4040+#define FORMAT_PATCH_NAME_MAX_DEFAULT 64
40414142/* Set a default date-time format for git log ("log.date" config variable) */
4243static const char *default_date_mode = NULL;
···5051static int decoration_given;
5152static int use_mailmap_config = 1;
5253static const char *fmt_patch_subject_prefix = "PATCH";
5454+static int fmt_patch_name_max = FORMAT_PATCH_NAME_MAX_DEFAULT;
5355static const char *fmt_pretty;
54565557static const char * const builtin_log_usage[] = {
···150152 rev->abbrev_commit = default_abbrev_commit;
151153 rev->show_root_diff = default_show_root;
152154 rev->subject_prefix = fmt_patch_subject_prefix;
155155+ rev->patch_name_max = fmt_patch_name_max;
153156 rev->show_signature = default_show_signature;
154157 rev->encode_email_headers = default_encode_email_headers;
155158 rev->diffopt.flags.allow_textconv = 1;
···457460 return git_config_string(&fmt_pretty, var, value);
458461 if (!strcmp(var, "format.subjectprefix"))
459462 return git_config_string(&fmt_patch_subject_prefix, var, value);
463463+ if (!strcmp(var, "format.filenamemaxlength")) {
464464+ fmt_patch_name_max = git_config_int(var, value);
465465+ return 0;
466466+ }
460467 if (!strcmp(var, "format.encodeemailheaders")) {
461468 default_encode_email_headers = git_config_bool(var, value);
462469 return 0;
···958965 struct rev_info *rev, int quiet)
959966{
960967 struct strbuf filename = STRBUF_INIT;
961961- int suffix_len = strlen(rev->patch_suffix) + 1;
962968963969 if (output_directory) {
964970 strbuf_addstr(&filename, output_directory);
965965- if (filename.len >=
966966- PATH_MAX - FORMAT_PATCH_NAME_MAX - suffix_len) {
967967- strbuf_release(&filename);
968968- return error(_("name of output directory is too long"));
969969- }
970971 strbuf_complete(&filename, '/');
971972 }
972973···17541755 N_("start numbering patches at <n> instead of 1")),
17551756 OPT_INTEGER('v', "reroll-count", &reroll_count,
17561757 N_("mark the series as Nth re-roll")),
17581758+ OPT_INTEGER(0, "filename-max-length", &fmt_patch_name_max,
17591759+ N_("max length of output filename")),
17571760 OPT_CALLBACK_F(0, "rfc", &rev, NULL,
17581761 N_("Use [RFC PATCH] instead of [PATCH]"),
17591762 PARSE_OPT_NOARG | PARSE_OPT_NONEG, rfc_callback),
···18541857 PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN |
18551858 PARSE_OPT_KEEP_DASHDASH);
1856185918601860+ /* Make sure "0000-$sub.patch" gives non-negative length for $sub */
18611861+ if (fmt_patch_name_max <= strlen("0000-") + strlen(fmt_patch_suffix))
18621862+ fmt_patch_name_max = strlen("0000-") + strlen(fmt_patch_suffix);
18631863+18571864 if (cover_from_description_arg)
18581865 cover_from_description_mode = parse_cover_from_description(cover_from_description_arg);
18591866···19381945 rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
1939194619401947 rev.zero_commit = zero_commit;
19481948+ rev.patch_name_max = fmt_patch_name_max;
1941194919421950 if (!rev.diffopt.flags.text && !no_binary_diff)
19431951 rev.diffopt.flags.binary = 1;
+1-1
log-tree.c
···367367 const char *suffix = info->patch_suffix;
368368 int nr = info->nr;
369369 int start_len = filename->len;
370370- int max_len = start_len + FORMAT_PATCH_NAME_MAX - (strlen(suffix) + 1);
370370+ int max_len = start_len + info->patch_name_max - (strlen(suffix) + 1);
371371372372 if (0 < info->reroll_count)
373373 strbuf_addf(filename, "v%d-", info->reroll_count);