git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[GSoC][RFC PATCH 6/6] t4014: add tests for the new flag --subject-extra-prefix

From
Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Date
Mar 3, 2025, 22:00 UTC
Message-ID
<20250303220029.10716-7-lucasseikioshiro@gmail.com>
In-Reply-To
<20250303220029.10716-1-lucasseikioshiro@gmail.com>

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(+)
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 884f83fb8a..1256ce2197 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -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
 '
-- 
2.39.5 (Apple Git-154)
Previous: Lucas Seiki OshiroNext: Junio C Hamano
Message 8 of 15 in “Add --subject-extra-prefix flag to format-patch”
  1. Lucas Seiki OshiroMar 3, 2025
  2. [GSoC][RFC PATCH 1/6] builtin/log: add subject-extra-prefix flag to format-patchLucas Seiki Oshiro, Mar 3, 2025
  3. [GSoC][RFC PATCH 2/6] builtin/log: die if -k and --suject-extra-prefix are used togetherLucas Seiki Oshiro, Mar 3, 2025
  4. Eric SunshineMar 3, 2025
  5. [GSoC][RFC PATCH 3/6] revision: add subject_extra_field to struct rev_infoLucas Seiki Oshiro, Mar 3, 2025
  6. [GSoC][RFC PATCH 4/6] builtin/log: fill subject extra prefix in format-patchLucas Seiki Oshiro, Mar 3, 2025
  7. [GSoC][RFC PATCH 5/6] log-tree: add subject prefix in output email subjectLucas Seiki Oshiro, Mar 3, 2025
  8. [GSoC][RFC PATCH 6/6] t4014: add tests for the new flag --subject-extra-prefixLucas Seiki Oshiro, Mar 3, 2025
  9. Junio C HamanoMar 3, 2025
  10. Patrick SteinhardtMar 4, 2025
  11. Junio C HamanoMar 4, 2025
  12. Junio C HamanoMar 4, 2025
  13. Lucas Seiki OshiroMar 4, 2025
  14. Junio C HamanoMar 5, 2025
  15. Lucas Seiki OshiroMar 5, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.