Skip to content

Conversation

SyntevoAlex
Copy link

@SyntevoAlex SyntevoAlex commented Dec 30, 2019

Please refer to commit messages for rationale.

This branch is a follow-up for [1] where part of branch was merged into `master` via [2].

Previously in [3] there were some concerns on whether removing
copy&pasted tests is good. I still think that yes, it 's a good thing,
mostly because of high volume of potential 13*6=78 duplicate tests.

Still, I separated this change as last patch, so that the remaining
part of the branch can be taken without it.

[1] https://lore.kernel.org/git/pull.490.git.1576161385.gitgitgadget@gmail.com/
[2] https://public-inbox.org/git/pull.445.v4.git.1575381738.gitgitgadget@gmail.com/
[3] https://lore.kernel.org/git/xmqqwoatcn5u.fsf@gitster-ct.c.googlers.com/

Changes since V1
----------------
Small code formatting changes suggested in V1.

Changes since V2
----------------
Changed \\\\ escaping to use here-doc instead.

Changes since V3
----------------
Slightly improved commit message.

Cc: Jonathan Nieder <jrnieder@gmail.com>
Cc: Eric Sunshine <sunshine@sunshineco.com>

@SyntevoAlex
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 30, 2019

@SyntevoAlex SyntevoAlex force-pushed the #0207(git)_2b_test_parse_directly branch from daef256 to 88086ce Compare December 30, 2019 19:12
@SyntevoAlex
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 30, 2019

@SyntevoAlex SyntevoAlex force-pushed the #0207(git)_2b_test_parse_directly branch from 88086ce to f71021b Compare December 31, 2019 09:52
@SyntevoAlex
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 31, 2019

@SyntevoAlex
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 31, 2019

Error: f71021b was already submitted

While working on the next patch, I also noticed that quotes testing via
`"\"file\\101.t\""` was somewhat incorrect: I escaped `\` one time while
I had to escape it two times! Tests still worked due to `"` being
preserved which in turn prevented pathspec from matching files.

Fix this by using here-doc instead.

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Previously, `parse_pathspec_file()` was tested indirectly by invoking
git commands with properly crafted inputs. As demonstrated by the
previous bugfix, testing complicated black boxes indirectly can lead to
tests that silently test the wrong thing.

Introduce direct tests for `parse_pathspec_file()`.

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
With direct tests for `parse_pathspec_file()` already in place, it is
not very reasonable to copy&paste 6 similar indirect tests for every git
command that uses `parse_pathspec_file()`. I counted 13 potential git
commands, which could eventually lead to 6*13=78 duplicate tests.

I believe that indirect tests are redundant because I don't expect
direct tests to ever disagree with indirect tests.

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
@SyntevoAlex SyntevoAlex force-pushed the #0207(git)_2b_test_parse_directly branch from f71021b to d02a1ea Compare December 31, 2019 10:13
@SyntevoAlex
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 31, 2019

@gitgitgadget
Copy link

gitgitgadget bot commented Jan 7, 2020

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Alexandr Miloslavskiy via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> This branch is a follow-up for [1] where part of branch was merged into `master` via [2].
>
> Previously in [3] there were some concerns on whether removing
> copy&pasted tests is good. I still think that yes, it 's a good thing,
> mostly because of high volume of potential 13*6=78 duplicate tests.
>
> Still, I separated this change as last patch, so that the remaining
> part of the branch can be taken without it.

With the third step the series won't merge cleanly with other topic
you have in 'next' (t7107 gets somewhat heavy merge conflicts).

I'll queue the first two for now but let's clean them up post 2.25
release.

Thanks.

@gitgitgadget
Copy link

gitgitgadget bot commented Jan 8, 2020

On the Git mailing list, Alexandr Miloslavskiy wrote (reply to this):

On 07.01.2020 22:13, Junio C Hamano wrote:
> With the third step the series won't merge cleanly with other topic
> you have in 'next' (t7107 gets somewhat heavy merge conflicts).
> 
> I'll queue the first two for now but let's clean them up post 2.25
> release.

OK, I will re-submit the remaining patch after 2.25.

I will implement the next --pathspec-from-file patches as if this third 
patch was accepted (that is, without copy&pasted tests).

Thanks for accepting this and other polishing branches, I was already 
quite pessimistic about them.

@gitgitgadget
Copy link

gitgitgadget bot commented Jan 8, 2020

On the Git mailing list, Junio C Hamano wrote (reply to this):

Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com> writes:

> On 07.01.2020 22:13, Junio C Hamano wrote:
>> With the third step the series won't merge cleanly with other topic
>> you have in 'next' (t7107 gets somewhat heavy merge conflicts).
>>
>> I'll queue the first two for now but let's clean them up post 2.25
>> release.
>
> OK, I will re-submit the remaining patch after 2.25.
>
> I will implement the next --pathspec-from-file patches as if this
> third patch was accepted (that is, without copy&pasted tests).

I am not sure if that is a good idea.  I'd rather see the planned
new changes not to be taken hostage of the third step.

Besides, with the third step, your preference is not to test the
behaviour of end-user facing commands that would learn the option at
all and only test the underlying machinery with test-tool tests, no?
If you are not adding tests for the higher-level end-user facing
commands as part of these new series, would it make a difference if
the codebase has the third step applied (i.e. missing tests for the
end-user facing commands that have already learned the option) or
not (i.e. the commands that have already learned the option are
still tested end-to-end)?

@gitgitgadget
Copy link

gitgitgadget bot commented Jan 8, 2020

On the Git mailing list, Alexandr Miloslavskiy wrote (reply to this):

On 08.01.2020 18:26, Junio C Hamano wrote:
>> I will implement the next --pathspec-from-file patches as if this
>> third patch was accepted (that is, without copy&pasted tests).
> 
> I am not sure if that is a good idea.  I'd rather see the planned
> new changes not to be taken hostage of the third step.

In my understanding, the new patches will not be taken hostage, they 
will simply adopt the new approach. Everything will work just fine 
whether or not third step is present.

> Besides, with the third step, your preference is not to test the
> behaviour of end-user facing commands that would learn the option at
> all and only test the underlying machinery with test-tool tests, no?

That's not exactly correct. Third step removes duplicate tests that give 
no real benefit. With test-tool tests in place and succceeding, these 
duplicate tests are super unlikely to fail.

I will still provide a few tests for every new command to make sure that 
said command works as intended. I will only skip indirectly testing 
global API again and again.

> If you are not adding tests for the higher-level end-user facing
> commands as part of these new series, would it make a difference if
> the codebase has the third step applied (i.e. missing tests for the
> end-user facing commands that have already learned the option) or
> not (i.e. the commands that have already learned the option are
> still tested end-to-end)?

I will be adding good tests and skip useless tests. For new commands, it 
doesn't really matter if "third step" patch is applied or not.

@gitgitgadget
Copy link

gitgitgadget bot commented Jan 8, 2020

On the Git mailing list, Junio C Hamano wrote (reply to this):

Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com> writes:

> I will still provide a few tests for every new command to make sure
> that said command works as intended. I will only skip indirectly
> testing global API again and again.

Ah, OK.  Then leaving those removed by the third step there may get
in the way.  So let's assume that we'll have an updated third step
already applied and your new series are written on top of it.

> ... For new commands, it doesn't really matter if "third step"
> patch is applied or not.

OK, again.  Thanks for a clarification.

@dscho
Copy link
Member

dscho commented May 8, 2020

The first two patches were accepted via 6909474, but the last one was dropped.

@dscho dscho closed this May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants