@@ -1444,6 +1444,46 @@ test_expect_success '--rfc and -k cannot be used together' '
test_cmp expect.err actual.err
'
+cat >expect <<'EOF'
+Subject: [EXTRA][PATCH] header with . in it
+EOF
+test_expect_success '--subject-extra-prefix adds extra prefix' '
+ git format-patch -1 --stdout --subject-extra-prefix=EXTRA >patch &&
+ grep ^Subject: patch >actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+Subject: [EXTRA][RFC PATCH] header with . in it
+EOF
+test_expect_success '--subject-extra-prefix works with --rfc' '
+ git format-patch --rfc -1 --stdout --subject-extra-prefix=EXTRA >patch &&
+ grep ^Subject: patch >actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+Subject: [EXTRA][PATCH 1/1] header with . in it
+EOF
+test_expect_success '--subject-extra-prefix works with numbered patches' '
+ git format-patch -n -1 --stdout --subject-extra-prefix=EXTRA >patch &&
+ grep ^Subject: patch >actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+Subject: [EXTRA][PATCH v2] header with . in it
+EOF
+test_expect_success '--subject-extra-prefix works with -v' '
+ git format-patch -v2 -1 --stdout --subject-extra-prefix=EXTRA >patch &&
+ grep ^Subject: patch >actual &&
+ test_cmp expect actual
+'
+
+test_expect_failure '--subject-extra-prefix does not run with -k' '
+ git format-patch -k -1 --stdout --subject-extra-prefix=EXTRA >/dev/null
+'
+
test_expect_success '--from=ident notices bogus ident' '
test_must_fail git format-patch -1 --stdout --from=foo >patch
'
Add tests for `format-patch --subject-extra-prefix` asserting that it works correctly in the following situations: - without other flags related to the prefix; - with the --rfc flag, which should add RFC to the prefix; - with the -n flag, which should add the numbering to the prefix; - with the -v flag, which should add the patch version to the prefix; - with the -k flag, diying as they aren't meant to be used together. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- t/t4014-format-patch.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)