format: Add --rfc option to use [RFC PATCH] as subject prefix

Josh Triplett created

Change summary

git-series.1 | 4 ++++
src/main.rs  | 7 ++++++-
2 files changed, 10 insertions(+), 1 deletion(-)

Detailed changes

git-series.1 🔗

@@ -113,6 +113,7 @@ To start working on the branch again, use \fBgit series checkout\fR.
 \fBgit series format\fR [\fB--in-reply-to=\fR\fIMessage-Id\fR] \
 [\fB--no-from\fR] \
 [\fB-v\fR \fIN\fR | \fB--reroll-count=\fR\fIN\fR] \
+[\fB--rfc\fR] \
 [\fB--stdout\fR] \
 [\fB--subject-prefix=\fR\fISubject-Prefix\fR]
 Prepare the patch series to send via email.
@@ -146,6 +147,9 @@ Use this when producing patch files for purposes other than email.
 Mark the patch series as PATCH v\fIN\fR.
 The patch filenames and mail subjects will include the version number.
 .TP
+.B --rfc
+Use [RFC PATCH] instead of the standard [PATCH] prefix.
+.TP
 .B --stdout
 Write the entire patch series to stdout rather than to separate patch files.
 .TP

src/main.rs 🔗

@@ -1199,7 +1199,11 @@ fn format(out: &mut Output, repo: &Repository, m: &ArgMatches) -> Result<()> {
     });
 
     let version = m.value_of("reroll-count");
-    let subject_prefix = m.value_of("subject-prefix").unwrap_or("PATCH");
+    let subject_prefix = if m.is_present("rfc") {
+        "RFC PATCH"
+    } else {
+        m.value_of("subject-prefix").unwrap_or("PATCH")
+    };
     let subject_patch = version.map_or(
             subject_prefix.to_string(),
             |n| format!("{}{}v{}", subject_prefix, ensure_space(&subject_prefix), n));
@@ -1696,6 +1700,7 @@ fn main() {
                     .arg_from_usage("--in-reply-to [Message-Id] 'Make the first mail a reply to the specified Message-Id'")
                     .arg_from_usage("--no-from 'Don't include in-body \"From:\" headers when formatting patches authored by others'")
                     .arg_from_usage("-v, --reroll-count=[N] 'Mark the patch series as PATCH vN'")
+                    .arg(Arg::from_usage("--rfc 'Use [RFC PATCH] instead of the standard [PATCH] prefix'").conflicts_with("subject-prefix"))
                     .arg_from_usage("--stdout 'Write patches to stdout rather than files'")
                     .arg_from_usage("--subject-prefix [Subject-Prefix] 'Use [Subject-Prefix] instead of the standard [PATCH] prefix'"),
                 SubCommand::with_name("log")