format-patch: allow --rfc to optionally take a value, like --rfc=WIP

With the "--rfc" option, we can tweak the "[PATCH]" (or whatever
string specified with the "--subject-prefix" option, instead of
"PATCH") that we prefix the title of the commit with into "[RFC
PATCH]", but some projects may want "[rfc PATCH]".  Adding a new
option, e.g., "--rfc-lowercase", to support such need every time
somebody wants to use different strings would lead to insanity of
accumulating unbounded number of such options.

Allow an optional value specified for the option, so that users can
use "--rfc=rfc" (think of "--rfc" without value as a short-hand for
"--rfc=RFC") if they wanted to.

This can of course be (ab)used to make the prefix "[WIP PATCH]" by
passing "--rfc=WIP".  Passing an empty string, i.e., "--rfc=", is
the same as "--no-rfc" to override an option given earlier on the
same command line.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2024-04-23 10:52:33 -07:00
parent 21306a098c
commit ce48fb2eab
3 changed files with 48 additions and 11 deletions

View File

@ -20,7 +20,7 @@ SYNOPSIS
[--in-reply-to=<message-id>] [--suffix=.<sfx>]
[--ignore-if-in-upstream] [--always]
[--cover-from-description=<mode>]
[--rfc] [--subject-prefix=<subject-prefix>]
[--rfc[=<rfc>]] [--subject-prefix=<subject-prefix>]
[(--reroll-count|-v) <n>]
[--to=<email>] [--cc=<email>]
[--[no-]cover-letter] [--quiet]
@ -238,10 +238,15 @@ the patches (with a value of e.g. "PATCH my-project").
value of the `format.filenameMaxLength` configuration
variable, or 64 if unconfigured.
--rfc::
Prepends "RFC" to the subject prefix (producing "RFC PATCH" by
default). RFC means "Request For Comments"; use this when sending
an experimental patch for discussion rather than application.
--rfc[=<rfc>]::
Prepends the string _<rfc>_ (defaults to "RFC") to
the subject prefix. As the subject prefix defaults to
"PATCH", you'll get "RFC PATCH" by default.
+
RFC means "Request For Comments"; use this when sending
an experimental patch for discussion rather than application.
"--rfc=WIP" may also be a useful way to indicate that a patch
is not complete yet ("WIP" stands for "Work In Progress").
-v <n>::
--reroll-count=<n>::