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

Re: [PATCH v5 2/2] send-email: expose header information to git-send-email's sendemail-validate hook

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 15, 2023, 03:34 UTC
Message-ID
<xmqqfsccii86.fsf@gitster.g>
In-Reply-To
<xmqqa62lm76t.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 16 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> "Strawbridge, Michael" <Michael.Strawbridge@amd.com> writes:
>>
>>> +test_expect_success $PREREQ "--validate hook supports header argument" '
>>> +	test_when_finished "rm my-hooks.ran" &&
>>> +	write_script my-hooks/sendemail-validate <<-\EOF &&
>>> +	filesize=$(stat -c%s "$2")
>>
>> That "stat -c" is a GNU-ism, I think.  macOS CI jobs at GitHub do
>> not seem to like it.
>>
>>> +	if [ "$filesize" != "0" ]; then
>>
>> Also, please see Documentation/CodingGuidelines to learn the subset
>> of shell script syntax and style we adopted for this project.

I'll tentatively queue this as a fix-up on top of the topic, but is this testing the right thing? Should we inspect "$2" and verify that it gives us what we expect, not just it being non-empty?

 t/t9001-send-email.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git c/t/t9001-send-email.sh w/t/t9001-send-email.sh
index f02b1eba16..b19997cbbc 100755
--- c/t/t9001-send-email.sh
+++ w/t/t9001-send-email.sh
@@ -568,9 +568,10 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
 test_expect_success $PREREQ "--validate hook supports header argument" '
 	test_when_finished "rm my-hooks.ran" &&
 	write_script my-hooks/sendemail-validate <<-\EOF &&
-	filesize=$(stat -c%s "$2")
-	if [ "$filesize" != "0" ]; then
-	>my-hooks.ran
+	rm -f my-hooks.ran
+	if test -s "$2"
+	then
+		>my-hooks.ran
 	fi
 	exit 1
 	EOF
Previous: Junio C HamanoNext: Luben Tuikov
Message 10 of 16 in “send-email: expose header information to git-send-email's sendemail-validate hook”
  1. 0/2 send-email: expose header information to git-send-email's sendemail-validate hookStrawbridge, Michael, Jan 10, 2023
  2. 1/2 send-email: refactor header generation functionsStrawbridge, Michael, Jan 10, 2023
  3. Ævar Arnfjörð BjarmasonJan 17, 2023
  4. Junio C HamanoJan 17, 2023
  5. 1/2 send-email: refactor header generation functionsStrawbridge, Michael, Jan 17, 2023
  6. 2/2 send-email: expose header information to git-send-email's sendemail-validate hookStrawbridge, Michael, Jan 10, 2023
  7. Junio C HamanoJan 14, 2023
  8. Junio C HamanoJan 14, 2023
  9. Junio C HamanoJan 14, 2023
  10. Junio C HamanoJan 15, 2023
  11. Luben TuikovJan 17, 2023
  12. Junio C HamanoJan 17, 2023
  13. Luben TuikovJan 17, 2023
  14. Ævar Arnfjörð BjarmasonJan 17, 2023
  15. 2/2 send-email: expose header information to git-send-email's sendemail-validate hookStrawbridge, Michael, Jan 17, 2023
  16. 0/2 send-email: expose header information to git-send-email's sendemail-validate hookStrawbridge, Michael, Jan 17, 2023

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.