{"thread":{"id":"66687","subject":"[PATCH v2] t/t1467: use test_must_fail in place of NOT operator","startedAt":"2026-10-28T10:23:45Z","lastAt":"2026-10-28T16:47:38Z","messageCount":2,"participants":["Hardik Kumar","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"556632","messageId":"20261028-refs-rename-test-fail-v2-1-505ca9558503@gmail.com","threadId":"66687","inReplyTo":null,"subject":"[PATCH v2] t/t1467: use test_must_fail in place of NOT operator","fromName":"Hardik Kumar","fromEmail":"hardikxk@gmail.com","sentAt":"2026-10-28T10:23:45Z","receivedAt":"2026-10-28T10:23:45Z","isPatch":true,"sender":{"key":"hardikxk@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183656738?v=4"},"body":"Replace the \"not\" (!) operator with `test_must_fail` for refs-rename\ntest.\n\nThe use of `test_must_fail` is preferred over not (!) operator because\nit ensures that the command fails gracefully. If the command crashes\n(e.g. a segfault) or is killed by a signal, the failure is handled\ncorrectly by `test_must_fail` which will fail the test whereas the `!`\noperator would silently accept the crash as an expected failure.\n\nSigned-off-by: Hardik Kumar <hardikxk@gmail.com>\n---\nChanges in v2:\n- Refactor commit message\n- Link to v1: https://lore.kernel.org/r/20261028-refs-rename-test-fail-v1-1-b7458ca62149@gmail.com\n---\n t/t1467-refs-rename.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t1467-refs-rename.sh b/t/t1467-refs-rename.sh\nindex 2b28be75c8..b7d290d05b 100755\n--- a/t/t1467-refs-rename.sh\n+++ b/t/t1467-refs-rename.sh\n@@ -88,7 +88,7 @@ test_expect_success 'rename with symbolic ref fails' '\n \t\tA=$(git rev-parse A) &&\n \t\tgit refs create refs/heads/target $A &&\n \t\tgit symbolic-ref refs/heads/symref refs/heads/target &&\n-\t\t! git refs rename refs/heads/symref refs/heads/renamed 2>err &&\n+\t\ttest_must_fail git refs rename refs/heads/symref refs/heads/renamed 2>err &&\n \t\ttest_grep \"is a symbolic ref, .* not supported\" err\n \t)\n '\n\n---\nbase-commit: 37b3475fb530c14109211faca33716a173db61ed\nchange-id: 20261028-refs-rename-test-fail-ec7a8fa74e54\n\n\n"},{"id":"556686","messageId":"xmqq8q3hbwlx.fsf@gitster.g","threadId":"66687","inReplyTo":"20261028-refs-rename-test-fail-v2-1-505ca9558503@gmail.com","subject":"Re: [PATCH v2] t/t1467: use test_must_fail in place of NOT operator","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-28T16:47:38Z","receivedAt":"2026-10-28T16:47:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Hardik Kumar <hardikxk@gmail.com> writes:\n\n> Replace the \"not\" (!) operator with `test_must_fail` for refs-rename\n> test.\n>\n> The use of `test_must_fail` is preferred over not (!) operator because\n> it ensures that the command fails gracefully. If the command crashes\n> (e.g. a segfault) or is killed by a signal, the failure is handled\n> correctly by `test_must_fail` which will fail the test whereas the `!`\n> operator would silently accept the crash as an expected failure.\n>\n> Signed-off-by: Hardik Kumar <hardikxk@gmail.com>\n> ---\n> Changes in v2:\n> - Refactor commit message\n> - Link to v1: https://lore.kernel.org/r/20261028-refs-rename-test-fail-v1-1-b7458ca62149@gmail.com\n> ---\n>  t/t1467-refs-rename.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n\nWill queue.  Thanks.\n\n> diff --git a/t/t1467-refs-rename.sh b/t/t1467-refs-rename.sh\n> index 2b28be75c8..b7d290d05b 100755\n> --- a/t/t1467-refs-rename.sh\n> +++ b/t/t1467-refs-rename.sh\n> @@ -88,7 +88,7 @@ test_expect_success 'rename with symbolic ref fails' '\n>  \t\tA=$(git rev-parse A) &&\n>  \t\tgit refs create refs/heads/target $A &&\n>  \t\tgit symbolic-ref refs/heads/symref refs/heads/target &&\n> -\t\t! git refs rename refs/heads/symref refs/heads/renamed 2>err &&\n> +\t\ttest_must_fail git refs rename refs/heads/symref refs/heads/renamed 2>err &&\n>  \t\ttest_grep \"is a symbolic ref, .* not supported\" err\n>  \t)\n>  '\n>\n> ---\n> base-commit: 37b3475fb530c14109211faca33716a173db61ed\n> change-id: 20261028-refs-rename-test-fail-ec7a8fa74e54\n\n"}]}