public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: git@vger•kernel.org
Subject: [PATCH 1/3] t7500: make each piece more independent
Date: Mon, 14 Oct 2024 13:44:25 -0700	[thread overview]
Message-ID: <20241014204427.1712182-2-gitster@pobox.com> (raw)
In-Reply-To: <20241014204427.1712182-1-gitster@pobox.com>

These tests prepare the working tree & index state to have something
to be committed, and try a sequence of "test_must_fail git commit".
If an earlier one did not fail by a bug, a later one will fail for
a wrong reason (namely, "nothing to commit").

Give them "--allow-empty" to make sure that they would work even
when there is nothing to commit by accident.

Signed-off-by: Junio C Hamano <gitster@pobox•com>
---
 t/t7500-commit-template-squash-signoff.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t7500-commit-template-squash-signoff.sh b/t/t7500-commit-template-squash-signoff.sh
index 4dca8d97a7..4927b7260d 100755
--- a/t/t7500-commit-template-squash-signoff.sh
+++ b/t/t7500-commit-template-squash-signoff.sh
@@ -50,33 +50,33 @@ test_expect_success 'nonexistent template file in config should return error' '
 TEMPLATE="$PWD"/template
 
 test_expect_success 'unedited template should not commit' '
-	echo "template line" > "$TEMPLATE" &&
-	test_must_fail git commit --template "$TEMPLATE"
+	echo "template line" >"$TEMPLATE" &&
+	test_must_fail git commit --allow-empty --template "$TEMPLATE"
 '
 
 test_expect_success 'unedited template with comments should not commit' '
-	echo "# comment in template" >> "$TEMPLATE" &&
-	test_must_fail git commit --template "$TEMPLATE"
+	echo "# comment in template" >>"$TEMPLATE" &&
+	test_must_fail git commit --allow-empty --template "$TEMPLATE"
 '
 
 test_expect_success 'a Signed-off-by line by itself should not commit' '
 	(
 		test_set_editor "$TEST_DIRECTORY"/t7500/add-signed-off &&
-		test_must_fail git commit --template "$TEMPLATE"
+		test_must_fail git commit --allow-empty --template "$TEMPLATE"
 	)
 '
 
 test_expect_success 'adding comments to a template should not commit' '
 	(
 		test_set_editor "$TEST_DIRECTORY"/t7500/add-comments &&
-		test_must_fail git commit --template "$TEMPLATE"
+		test_must_fail git commit --allow-empty --template "$TEMPLATE"
 	)
 '
 
 test_expect_success 'adding real content to a template should commit' '
 	(
 		test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
-		git commit --template "$TEMPLATE"
+		git commit --allow-empty --template "$TEMPLATE"
 	) &&
 	commit_msg_is "template linecommit message"
 '
-- 
2.47.0-148-g19c85929c5


  reply	other threads:[~2024-10-14 20:44 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-07 20:27 [PATCH 0/1] blame: Skip missing ignore-revs file Noah Pendleton
2021-08-07 20:58 ` Junio C Hamano
2021-08-07 21:34   ` Noah Pendleton
2021-08-08  5:43     ` Junio C Hamano
2021-08-08 17:50       ` Junio C Hamano
2021-08-08 18:21         ` Noah Pendleton
2021-08-09 15:47           ` Junio C Hamano
2024-10-14 20:44             ` [PATCH 0/3] specifying a file that can optionally exist Junio C Hamano
2024-10-14 20:44               ` Junio C Hamano [this message]
2024-10-14 20:44               ` [PATCH 2/3] config: values of pathname type can be prefixed with :(optional) Junio C Hamano
2024-10-14 20:44               ` [PATCH 3/3] parseopt: " Junio C Hamano
2025-05-01 21:40             ` [PATCH 0/3] specifying a file that can optionally exist Junio C Hamano
2025-05-01 21:40               ` [PATCH 1/3] t7500: make each piece more independent Junio C Hamano
2025-05-01 21:40               ` [PATCH 2/3] config: values of pathname type can be prefixed with :(optional) Junio C Hamano
2025-05-02  8:52                 ` Patrick Steinhardt
2025-05-02 14:28                   ` Phillip Wood
2025-05-02 20:05                   ` Junio C Hamano
2025-05-01 21:40               ` [PATCH 3/3] parseopt: " Junio C Hamano
2025-09-28 21:29               ` [PATCH v2 0/3] Support :(optional) filepaths D. Ben Knoble
2025-09-28 21:29                 ` [PATCH v2 1/3] t7500: make each piece more independent D. Ben Knoble
2025-09-28 21:29                 ` [PATCH v2 2/3] config: values of pathname type can be prefixed with :(optional) D. Ben Knoble
2025-09-30 15:26                   ` Phillip Wood
2025-10-06 19:00                     ` Junio C Hamano
2025-10-06 19:59                       ` Junio C Hamano
2025-10-06 20:21                         ` Junio C Hamano
2025-10-06 20:22                           ` Junio C Hamano
2025-10-07 12:24                           ` Kristoffer Haugsbakk
2025-10-07 17:04                             ` Junio C Hamano
2025-11-02 16:20                     ` D. Ben Knoble
2025-09-28 21:29                 ` [PATCH v2 3/3] parseopt: " D. Ben Knoble
2025-09-30 15:26                   ` Phillip Wood
2025-11-02 16:20                     ` D. Ben Knoble
2025-11-03  0:10                       ` Eric Sunshine
2025-11-04 18:22                         ` D. Ben Knoble
2025-09-28 22:40                 ` [PATCH v2 0/3] Support :(optional) filepaths Junio C Hamano
2025-09-29 16:42                   ` Ben Knoble
2025-10-20  9:40                 ` [PATCH] t7500: fix tests with absolute path following ":(optional)" on Windows Johannes Sixt
2025-10-20 13:43                   ` Ben Knoble
2025-10-20 17:32                     ` Johannes Sixt
2025-10-20 18:06                       ` Junio C Hamano
2025-10-20 20:27                       ` D. Ben Knoble
2025-10-20 20:27                         ` D. Ben Knoble
2025-10-20 17:39                     ` Eric Sunshine
2025-10-20 16:17                   ` Junio C Hamano
2025-10-20 17:24                     ` Johannes Sixt
2022-03-04  9:51   ` [PATCH 0/1] blame: Skip missing ignore-revs file Thranur Andul
2021-08-08 17:48 ` [PATCH v2] blame: add config `blame.ignoreRevsFileIsOptional` Noah Pendleton
  -- strict thread matches above, loose matches on Subject: below --
2025-04-25 18:41 Feature request: automatically read .git-blame-ignore-revs or allow global optional config Michael Grosser
2025-04-25 19:54 ` Eric Sunshine
2025-05-01 18:00   ` D. Ben Knoble
2025-05-01 18:28     ` Eric Sunshine

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=20241014204427.1712182-2-gitster@pobox.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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