[PATCH 4/4] t4014: add tests to cover --resend option and its exclusivity
- From
- Dragan Simic <dsimic@manjaro.org>
- Date
- Apr 17, 2024, 03:32 UTC
- Message-ID
- <42865d6c6694b9e6b745c328d717ed244dc25a1a.1713324598.git.dsimic@manjaro.org>
- In-Reply-To
- <cover.1713324598.git.dsimic@manjaro.org>
Add a few new tests to the t4014 that cover the --resend command-line option for "git format-patch", which include the tests for its exclusivity with the already existing -k and --rfc command-line options.
Signed-off-by: Dragan Simic <dsimic@manjaro.org> --- t/t4014-format-patch.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index e22c4ac34e6e..bcf7b633e78f 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1401,6 +1401,43 @@ test_expect_success '--rfc and -k cannot be used together' ' test_must_fail git format-patch -1 --stdout --rfc -k >patch ' +test_expect_success '--resend' ' + cat >expect <<-\EOF && + Subject: [PATCH RESEND 1/1] header with . in it + EOF + git format-patch -n -1 --stdout --resend >patch && + grep "^Subject:" patch >actual && + test_cmp expect actual +' + +test_expect_success '--resend does not overwrite prefix' ' + cat >expect <<-\EOF && + Subject: [PATCH RFC RESEND 1/1] header with . in it + EOF + git -c format.subjectPrefix="PATCH RFC" \ + format-patch -n -1 --stdout --resend >patch && + grep "^Subject:" patch >actual && + test_cmp expect actual +' + +test_expect_success '--resend is argument order independent' ' + cat >expect <<-\EOF && + Subject: [PATCH RFC RESEND 1/1] header with . in it + EOF + git format-patch -n -1 --stdout --resend \ + --subject-prefix="PATCH RFC" >patch && + grep "^Subject:" patch >actual && + test_cmp expect actual +' + +test_expect_success '--resend and -k cannot be used together' ' + test_must_fail git format-patch -1 --stdout --resend -k >patch +' + +test_expect_success '--rfc and --resend cannot be used together' ' + test_must_fail git format-patch -1 --stdout --rfc --resend >patch +' + test_expect_success '--from=ident notices bogus ident' ' test_must_fail git format-patch -1 --stdout --from=foo >patch '