Skip to content

Commit e447d31

Browse files
committed
Merge branch 'jt/format-patch-rfc'
In some projects, it is common to use "[RFC PATCH]" as the subject prefix for a patch meant for discussion rather than application. A new option "--rfc" was a short-hand for "--subject-prefix=RFC PATCH" to help the participants of such projects. * jt/format-patch-rfc: format-patch: add "--rfc" for the common case of [RFC PATCH]
2 parents 2a1f3fe + 68e83a5 commit e447d31

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

Documentation/git-format-patch.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ SYNOPSIS
1919
[--start-number <n>] [--numbered-files]
2020
[--in-reply-to=Message-Id] [--suffix=.<sfx>]
2121
[--ignore-if-in-upstream]
22-
[--subject-prefix=Subject-Prefix] [(--reroll-count|-v) <n>]
22+
[--rfc] [--subject-prefix=Subject-Prefix]
23+
[(--reroll-count|-v) <n>]
2324
[--to=<email>] [--cc=<email>]
2425
[--[no-]cover-letter] [--quiet] [--notes[=<ref>]]
2526
[<common diff options>]
@@ -172,6 +173,11 @@ will want to ensure that threading is disabled for `git send-email`.
172173
allows for useful naming of a patch series, and can be
173174
combined with the `--numbered` option.
174175

176+
--rfc::
177+
Alias for `--subject-prefix="RFC PATCH"`. RFC means "Request For
178+
Comments"; use this when sending an experimental patch for
179+
discussion rather than application.
180+
175181
-v <n>::
176182
--reroll-count=<n>::
177183
Mark the series as the <n>-th iteration of the topic. The

builtin/log.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,11 @@ static int subject_prefix_callback(const struct option *opt, const char *arg,
11111111
return 0;
11121112
}
11131113

1114+
static int rfc_callback(const struct option *opt, const char *arg, int unset)
1115+
{
1116+
return subject_prefix_callback(opt, "RFC PATCH", unset);
1117+
}
1118+
11141119
static int numbered_cmdline_opt = 0;
11151120

11161121
static int numbered_callback(const struct option *opt, const char *arg,
@@ -1418,6 +1423,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
14181423
N_("start numbering patches at <n> instead of 1")),
14191424
OPT_INTEGER('v', "reroll-count", &reroll_count,
14201425
N_("mark the series as Nth re-roll")),
1426+
{ OPTION_CALLBACK, 0, "rfc", &rev, NULL,
1427+
N_("Use [RFC PATCH] instead of [PATCH]"),
1428+
PARSE_OPT_NOARG | PARSE_OPT_NONEG, rfc_callback },
14211429
{ OPTION_CALLBACK, 0, "subject-prefix", &rev, N_("prefix"),
14221430
N_("Use [<prefix>] instead of [PATCH]"),
14231431
PARSE_OPT_NONEG, subject_prefix_callback },
@@ -1556,7 +1564,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
15561564
if (numbered && keep_subject)
15571565
die (_("-n and -k are mutually exclusive."));
15581566
if (keep_subject && subject_prefix)
1559-
die (_("--subject-prefix and -k are mutually exclusive."));
1567+
die (_("--subject-prefix/--rfc and -k are mutually exclusive."));
15601568
rev.preserve_subject = keep_subject;
15611569

15621570
argc = setup_revisions(argc, argv, &rev, &s_r_opt);

t/t4014-format-patch.sh

+9
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,15 @@ test_expect_success 'empty subject prefix does not have extra space' '
10861086
test_cmp expect actual
10871087
'
10881088

1089+
test_expect_success '--rfc' '
1090+
cat >expect <<-\EOF &&
1091+
Subject: [RFC PATCH 1/1] header with . in it
1092+
EOF
1093+
git format-patch -n -1 --stdout --rfc >patch &&
1094+
grep ^Subject: patch >actual &&
1095+
test_cmp expect actual
1096+
'
1097+
10891098
test_expect_success '--from=ident notices bogus ident' '
10901099
test_must_fail git format-patch -1 --stdout --from=foo >patch
10911100
'

0 commit comments

Comments
 (0)