Article View: linux.kernel.git
Article #302[PATCH v2] SubmittingPatches: avoid add-failing-test-then-fix anti-pattern
From: Jon Simons
Date: Mon, 12 Oct 2026 03:00
Date: Mon, 12 Oct 2026 03:00
43 lines
7286 bytes
7286 bytes
Document the preference to avoid the 'add a failing test and fix it in
a subsequent commit' anti-pattern. Although such a sequence is fine
for local development, reviewers instead prefer a single commit that
introduces the test together with its code change [1].
The goal of this addition is to capture the preference in writing, with
hopes of optimizing future review flows by reducing back-and-forths to
the list.
[1] A couple examples of feedback, with rationale for avoiding
the pattern, from August 2025 here:
- https://lore.kernel.org/git/xmqqqzxpzo8b.fsf@gitster.g/
- https://lore.kernel.org/git/xmqqfrdk3aqy.fsf@gitster.g/
Signed-off-by: Jon Simons <jon@jonsimons.org>
---
Documentation/SubmittingPatches | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index c60855f706..3238a33932 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -271,6 +271,15 @@ fixed by accident to avoid regression. Also, try merging your work to
that are still in flight may have unexpected interactions with what
you are trying to do in your topic.
+A bugfix patch should include tests in test_expect_success() blocks that
+demonstrate the breakage when the code change that implements the fix is
+omitted. Submit tests as `test_expect_success` in the same commit as
+your code change that fixes the bug. A separate commit that only changes
+`test_expect_failure` to `test_expect_success` can leave the behavior
+being tested out of the diff context, making the fix harder to review.
+Reviewers who want to verify that your test reproduces the bug can
+temporarily undo the code changes while keeping the test.
+
Pushing to a fork of https://github.com/git/git will use their CI
integration to test your changes on Linux, Mac and Windows. See the
<<GHCI,GitHub CI>> section for details.
--
2.55.0
Technical Details
Message-ID:
<20261012030029.12200-1-jon@jonsimons.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-71728-linux-kernel-git=dewy.ruReferences:
<20261011153206.72386-1-jon@jonsimons.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-71728-linux-kernel-git=dewy.ru From: jon@jonsimons.org (Jon Simons) Newsgroups: linux.kernel.git Subject: [PATCH v2] SubmittingPatches: avoid add-failing-test-then-fix anti-pattern Date: Sun, 11 Oct 2026 23:00:29 -0400 Organization: Usenet Network Message-ID: <20261012030029.12200-1-jon@jonsimons.org> References: <20261011153206.72386-1-jon@jonsimons.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1680609"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:uXtyv4HMVypp3LqA1PM4DwpwhSY= sha256:PdhHizlMBU0DtgJnLGpU7Bn5cm8YGVOFMiNLAY0EaaQ= sha1:VBImvo9rZ2wBGGTaArs4sctfay8= sha256:gE0NRMkiusQWeS07MLcIM+GzvpaUgJyjYuXqFJkqYMA= List-ID: <git.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id A635A10FAD4; Mon, 12 Oct 2026 07:17:26 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -0.851 X-Spam-Status: No, score=-0.851 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=jonsimons.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X-_X9HsLHJUW; Mon, 12 Oct 2026 07:17:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=git+bounces-71728-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=jonsimons.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 03DE110FAB7; Mon, 12 Oct 2026 07:17:14 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sto.lore.kernel.org (Postfix) with ESMTP id 304206022D5; Mon, 12 Oct 2026 04:17:14 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11B203955D3; Mon, 12 Oct 2026 04:17:10 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=jonsimons.org header.i=@jonsimons.org header.b="aZh1RIXJ" X-Received: from smtp110.iad3b.emailsrvr.com (smtp110.iad3b.emailsrvr.com [146.20.161.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA90637BE6F for <git@vger.kernel.org>; Mon, 12 Oct 2026 04:17:06 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=146.20.161.110 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791778628; cv=none; b=HY0oc8bYnopOJ54bW8VkTTbEr23Uj48U/I/WELkVNmaN4C+PdhdJQqvb2zQsapNYHvSBv/JoF9emRiFdxBpYQ0y4cKRpKp7kc/YgX52coPWF4GoFN7QEmfvn1byt2ycyPQqPVGyelCp1cppW7i3qkbsl7+lPEM0udo1pR3yGuWo= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791778628; c=relaxed/simple; bh=zMg0ZiF+hqnITSqEZR17EPJfCH/ogSNJdADf2AJmtGQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dz0j2PXqWVcdKTtdCT8Ml+OgDDj9JLRMvEC4qJOaOltzdTQTIB8itGwv2A3ZWdueEw0Fb+LoIjAKAnkuoJOqNUdUnZzGDqo+C12HDpEPnor1yHRg4oEzs93VCbSzGbIOodvmV6jZETm/T12xBIrwLGpYAxNekVDRFLMgAP8StdA= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jonsimons.org; spf=pass smtp.mailfrom=jonsimons.org; dkim=pass (1024-bit key) header.d=jonsimons.org header.i=@jonsimons.org header.b=aZh1RIXJ; arc=none smtp.client-ip=146.20.161.110 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jonsimons.org X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jonsimons.org X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=jonsimons.org; s=20200911-u7gnnm7o; t=1791774033; bh=zMg0ZiF+hqnITSqEZR17EPJfCH/ogSNJdADf2AJmtGQ=; h=From:To:Subject:Date:From; b=aZh1RIXJvOISLIesE3PIDSZnjw0CyoynIPQEQPtLtTqO55mj23MkiKxOWr8UzGfCm GOwNR/+Mb8okedep+EPqGauAHkjqJ2Fml7fSKOum8GTrqwZMqhk28x4a5IQA77Xpu2 AKW7kYeRy1tp09shE43Zpct3Ay9oZeF3fcaBJFSI= X-Auth-ID: jon@jonsimons.org X-Received: by smtp14.relay.iad3b.emailsrvr.com (Authenticated sender: jon-AT-jonsimons.org) with ESMTPSA id 4ABE4E0334; Sun, 11 Oct 2026 23:00:33 -0400 (EDT) X-Cc: Jon Simons <jon@jonsimons.org> X-Mailer: git-send-email 2.55.0 X-In-Reply-To: <20261011153206.72386-1-jon@jonsimons.org> X-Precedence: bulk X-Mailing-List: git@vger.kernel.org X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org> X-Classification-ID: 620fd428-2aa9-45ae-898a-537f823307bf-1-1