From 3baf58bfb4bcfe201970abeffa8e1396d2324250 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 6 Nov 2020 13:56:24 -0800 Subject: format-patch: make output filename configurable For the past 15 years, we've used the hardcoded 64 as the length limit of the filename of the output from the "git format-patch" command. Since the value is shorter than the 80-column terminal, it could grow without line wrapping a bit. At the same time, since the value is longer than half of the 80-column terminal, we could fit two or more of them in "ls" output on such a terminal if we allowed to lower it. Introduce a new command line option --filename-max-length= and a new configuration variable format.filenameMaxLength to override the hardcoded default. While we are at it, remove a check that the name of output directory does not exceed PATH_MAX---this check is pointless in that by the time control reaches the function, the caller would already have done an equivalent of "mkdir -p", so if the system does not like an overly long directory name, the control wouldn't have reached here, and otherwise, we know that the system allowed the output directory to exist. In the worst case, we will get an error when we try to open the output file and handle the error correctly anyway. Signed-off-by: Junio C Hamano --- Documentation/git-format-patch.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Documentation/git-format-patch.txt') diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt index 0f81d0437b..3347702b71 100644 --- a/Documentation/git-format-patch.txt +++ b/Documentation/git-format-patch.txt @@ -28,6 +28,7 @@ SYNOPSIS [--no-notes | --notes[=]] [--interdiff=] [--range-diff= [--creation-factor=]] + [--filename-max-length=] [--progress] [] [ | ] @@ -200,6 +201,13 @@ populated with placeholder text. allows for useful naming of a patch series, and can be combined with the `--numbered` option. +--filename-max-length=:: + Instead of the standard 64 bytes, chomp the generated output + filenames at around '' bytes (too short a value will be + silently raised to a reasonable length). Defaults to the + value of the `format.filenameMaxLength` configuration + variable, or 64 if unconfigured. + --rfc:: Alias for `--subject-prefix="RFC PATCH"`. RFC means "Request For Comments"; use this when sending an experimental patch for -- cgit v1.2.3