Merge branch 'jc/format-patch-rfc-more'

The "--rfc" option of "git format-patch" learned to take an
optional string value to be used in place of "RFC" to tweak the
"[PATCH]" on the subject header.

* jc/format-patch-rfc-more:
  format-patch: "--rfc=-(WIP)" appends to produce [PATCH (WIP)]
  format-patch: allow --rfc to optionally take a value, like --rfc=WIP
This commit is contained in:
Junio C Hamano
2024-04-30 14:49:42 -07:00
3 changed files with 65 additions and 10 deletions

View File

@ -1368,12 +1368,38 @@ test_expect_success 'empty subject prefix does not have extra space' '
test_cmp expect actual
'
test_expect_success '--rfc' '
test_expect_success '--rfc and --no-rfc' '
cat >expect <<-\EOF &&
Subject: [RFC PATCH 1/1] header with . in it
EOF
git format-patch -n -1 --stdout --rfc >patch &&
grep "^Subject:" patch >actual &&
test_cmp expect actual &&
git format-patch -n -1 --stdout --rfc --no-rfc >patch &&
sed -e "s/RFC //" expect >expect-raw &&
grep "^Subject:" patch >actual &&
test_cmp expect-raw actual
'
test_expect_success '--rfc=WIP and --rfc=' '
cat >expect <<-\EOF &&
Subject: [WIP PATCH 1/1] header with . in it
EOF
git format-patch -n -1 --stdout --rfc=WIP >patch &&
grep "^Subject:" patch >actual &&
test_cmp expect actual &&
git format-patch -n -1 --stdout --rfc --rfc= >patch &&
sed -e "s/WIP //" expect >expect-raw &&
grep "^Subject:" patch >actual &&
test_cmp expect-raw actual
'
test_expect_success '--rfc=-(WIP) appends' '
cat >expect <<-\EOF &&
Subject: [PATCH (WIP) 1/1] header with . in it
EOF
git format-patch -n -1 --stdout --rfc="-(WIP)" >patch &&
grep "^Subject:" patch >actual &&
test_cmp expect actual
'