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

Re: separating regression test patches from fixes, was Re: [PATCH 3/3] cherry-pick --continue: remember options

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 18, 2019, 00:46 UTC
Message-ID
<xmqqbm2980wk.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CACsJy8DCZLNNa9zFj04kPx=f1S_5VJqqP_qTK6QYJ0fFmusymg@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 15 quoted lines
> On Thu, Mar 14, 2019 at 9:10 PM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>> In any case, before we get better tooling to work around these issues, I
>> still think it makes a ton of sense to encourage proper separation of
>> concerns: to keep patches that introduce regression tests demonstrating a
>> breakage separate from patches that fix the breakage. It would certainly
>> help me (e.g. when staring at a range diff).
>
> Then perhaps improve the tools now because these separate patches
> enter 'master' and stay in the history forever. One of the problems I
> have with separating tests from the actual code change is the
> description of the problem often stays on the test commit, which I
> can't see in git-log if I'm searching for the code change. And no
> sometimes I can't just look at the parent commit if I filter code by
> path (and with --full-diff)

I do not think the phrase "separation of concerns" is applied correctly here.

The concern of a simple single-patch is to fix a bug---the test that shows what bug was fixed and protects the code by ensuring that a reintroduction of the bug gets noticed is an integral part of it. It does not make much sense to artificially split it into two.

It's like arguing for adding declarations for new functions and global variables in *.h files in a step before a separate step adds their implementations in *.c files, claiming that the first step designs the interface (which is sufficient for writing the client code) and the second one gives an implementation of the interface (which can be replaced later), and they address two separate concerns.

And then you would find that there are some compilers that warn against unimplemented functions and undefined variables. The "solution" would be to enclose the whole thing that was added in the first "*.h only patch" inside "#if 0/#endif" to hide it from the compiler ;-) That in fact looks quite similar to how "test only patch" marks the new tests as expecting failure in the beginning. Neither is truly useful when applied to a context different from where it is originally developed for.

Previous: Duy NguyenNext: Johannes Schindelin
Message 8 of 10 in “sequencer: break some long lines”
  1. 1/3 sequencer: break some long linesPhillip Wood, Mar 13, 2019
  2. 2/3 cherry-pick: demonstrate option amnesiaPhillip Wood, Mar 13, 2019
  3. 3/3 cherry-pick --continue: remember optionsPhillip Wood, Mar 13, 2019
  4. Johannes SchindelinMar 13, 2019
  5. Junio C HamanoMar 14, 2019
  6. separating regression test patches from fixes, was Re: [PATCH 3/3] cherry-pick --continue: remember optionsJohannes Schindelin, Mar 14, 2019
  7. Duy NguyenMar 14, 2019
  8. Junio C HamanoMar 18, 2019
  9. Johannes SchindelinMar 21, 2019
  10. Junio C HamanoMar 18, 2019

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.