From: Junio C Hamano <gitster@pobox.com>
To: Jon Simons <jon@jonsimons.org>
Cc: git@vger.kernel.org,
Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH v2] SubmittingPatches: avoid add-failing-test-then-fix anti-pattern
Date: Mon, 12 Oct 2026 07:34:33 -0700 [thread overview]
Message-ID: <xmqq4ierasxy.fsf@gitster.g> (raw)
In-Reply-To: <20261012030029.12200-1-jon@jonsimons.org> (Jon Simons's message of "Sun, 11 Oct 2026 23:00:29 -0400")
Jon Simons <jon@jonsimons.org> writes:
> +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.
Doesn't the second sentence "Submit tests ..." merely repeat what
the first sentence already says without adding much value? After
re-reading them three times, I think "the same commit" is the only
new point. I would condense the first two sentences down to
A bugfix patch should add, in the same commit, code change and
test_expect_success() blocks that demonstrate the breakage when
the fix is omitted.
or something, if I were writing this from scratch.
By the way, I consider that the SubmittingPatches document is
primarily about giving readers a set of rules they should follow,
and not about teaching the reasoning behind a rule to such a deep
level, unless the rule requires judgment on when or when not to
apply it. We agreed we do not need "unless there is a strong reason
not to", which means there is no judgment needed, so I was not
expecting to see the latter half of the paragraph.
Having said all that, i will queue this version as-is because we are
quickly reaching the point of diminishing returns. Thanks.
prev parent reply other threads:[~2026-10-12 14:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 15:32 [PATCH] SubmittingPatches: avoid add-failing-test-then-fix anti-pattern Jon Simons
2026-10-11 16:21 ` Kristoffer Haugsbakk
2026-10-11 23:44 ` Junio C Hamano
2026-10-12 1:46 ` Jon Simons
2026-10-12 3:00 ` [PATCH v2] " Jon Simons
2026-10-12 14:34 ` 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=xmqq4ierasxy.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jon@jonsimons.org \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.