From: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
To: git@vger.kernel.org
Cc: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Subject: [GSoC][RFC PATCH 6/6] t4014: add tests for the new flag --subject-extra-prefix
Date: Mon, 3 Mar 2025 19:00:29 -0300 [thread overview]
Message-ID: <20250303220029.10716-7-lucasseikioshiro@gmail.com> (raw)
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)
next prev parent reply other threads:[~2025-03-03 22:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 22:00 [GSoC][RFC PATCH 0/6] Add --subject-extra-prefix flag to format-patch Lucas Seiki Oshiro
2025-03-03 22:00 ` [GSoC][RFC PATCH 1/6] builtin/log: add subject-extra-prefix " Lucas Seiki Oshiro
2025-03-03 22:00 ` [GSoC][RFC PATCH 2/6] builtin/log: die if -k and --suject-extra-prefix are used together Lucas Seiki Oshiro
2025-03-03 22:36 ` Eric Sunshine
2025-03-03 22:00 ` [GSoC][RFC PATCH 3/6] revision: add subject_extra_field to struct rev_info Lucas Seiki Oshiro
2025-03-03 22:00 ` [GSoC][RFC PATCH 4/6] builtin/log: fill subject extra prefix in format-patch Lucas Seiki Oshiro
2025-03-03 22:00 ` [GSoC][RFC PATCH 5/6] log-tree: add subject prefix in output email subject Lucas Seiki Oshiro
2025-03-03 22:00 ` Lucas Seiki Oshiro [this message]
2025-03-03 23:08 ` [GSoC][RFC PATCH 0/6] Add --subject-extra-prefix flag to format-patch Junio C Hamano
2025-03-04 7:32 ` Patrick Steinhardt
2025-03-04 22:06 ` Junio C Hamano
2025-03-04 13:05 ` Junio C Hamano
2025-03-04 23:19 ` Lucas Seiki Oshiro
2025-03-05 2:06 ` Junio C Hamano
2025-03-05 14:26 ` Lucas Seiki Oshiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250303220029.10716-7-lucasseikioshiro@gmail.com \
--to=lucasseikioshiro@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).