From: Junio C Hamano <gitster@pobox•com>
To: git@vger•kernel.org
Cc: "Jeff King" <peff@peff•net>,
"Carlo Marcelo Arenas Belón" <carenas@gmail•com>,
"Eric Sunshine" <sunshine@sunshineco•com>
Subject: [PATCH v2] coccicheck: fail "make" when it fails
Date: Mon, 23 Jun 2025 09:14:11 -0700 [thread overview]
Message-ID: <xmqqbjqe77vw.fsf@gitster.g> (raw)
In-Reply-To: <xmqqwm97bv7c.fsf@gitster.g> (Junio C. Hamano's message of "Thu, 19 Jun 2025 08:35:35 -0700")
With "make coccicheck", we generate contrib/coccinelle/*.cocci.patch
files that contain changes suggested by semantic patches, but "make"
succeeds. Admittedly, not many developers may run "make coccicheck"
in the first place, but it makes it harder to notice when they do
run it after they introduced an iffy piece of code.
Check that the resulting cocci.patch files are all empty.
Signed-off-by: Junio C Hamano <gitster@pobox•com>
---
Makefile | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 97e8385b66..8f1e9424a7 100644
--- a/Makefile
+++ b/Makefile
@@ -3422,11 +3422,14 @@ endif
coccicheck-test: $(COCCI_TEST_RES_GEN)
coccicheck: coccicheck-test
+
ifdef SPATCH_CONCAT_COCCI
-coccicheck: contrib/coccinelle/ALL.cocci.patch
+COCCICHECK_PATCH_MUST_BE_EMPTY_FILES = contrib/coccinelle/ALL.cocci.patch
else
-coccicheck: $(COCCICHECK_PATCHES_INTREE)
+COCCICHECK_PATCH_MUST_BE_EMPTY_FILES = $(COCCICHECK_PATCHES_INTREE)
endif
+coccicheck: $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES)
+ ! grep -q ^ $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES) /dev/null
# See contrib/coccinelle/README
coccicheck-pending: coccicheck-test
Range-diff against v1:
1: 163a63f2cf ! 1: dee873e931 coccicheck: fail "make" when it fails
@@ Commit message
Signed-off-by: Junio C Hamano <gitster@pobox•com>
## Makefile ##
-@@ Makefile: coccicheck-test: $(COCCI_TEST_RES_GEN)
+@@ Makefile: endif
+ coccicheck-test: $(COCCI_TEST_RES_GEN)
+
coccicheck: coccicheck-test
++
ifdef SPATCH_CONCAT_COCCI
- coccicheck: contrib/coccinelle/ALL.cocci.patch
-+ ! test -s contrib/coccinelle/ALL.cocci.patch
+-coccicheck: contrib/coccinelle/ALL.cocci.patch
++COCCICHECK_PATCH_MUST_BE_EMPTY_FILES = contrib/coccinelle/ALL.cocci.patch
else
- coccicheck: $(COCCICHECK_PATCHES_INTREE)
-+ test $$(cat $(COCCICHECK_PATCHES_INTREE) | wc -c) = 0
+-coccicheck: $(COCCICHECK_PATCHES_INTREE)
++COCCICHECK_PATCH_MUST_BE_EMPTY_FILES = $(COCCICHECK_PATCHES_INTREE)
endif
++coccicheck: $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES)
++ ! grep -q ^ $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES) /dev/null
# See contrib/coccinelle/README
+ coccicheck-pending: coccicheck-test
--
2.50.0-243-g67b26bc0ed
prev parent reply other threads:[~2025-06-23 16:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 15:35 [RFC PATCH] coccicheck: fail "make" when it fails Junio C Hamano
2025-06-21 5:16 ` Jeff King
2025-06-21 6:29 ` Carlo Marcelo Arenas Belón
2025-06-21 8:09 ` Eric Sunshine
2025-06-22 4:18 ` Junio C Hamano
2025-06-23 16:14 ` Junio C Hamano [this message]
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=xmqqbjqe77vw.fsf@gitster.g \
--to=gitster@pobox$(echo .)com \
--cc=carenas@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=peff@peff$(echo .)net \
--cc=sunshine@sunshineco$(echo .)com \
/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