On Tue, Jul 12, 2022 at 5:52 PM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote: > > +test_expect_success 'fetch any commit from promisor with the usage of the commit graph' ' > > + # setup promisor and prepare any commit to fetch > > + git -C with-commit-graph remote add origin "$(pwd)/with-commit" && > > + git -C with-commit-graph config remote.origin.promisor true && > > + git -C with-commit-graph config remote.origin.partialclonefilter blob:none && > > + test_commit -C with-commit any-commit && > > + anycommit=$(git -C with-commit rev-parse HEAD) && > > + GIT_TRACE="$(pwd)/trace.txt" \ > > + git -C with-commit-graph fetch origin $anycommit 2>err && > > + ! grep "fatal: promisor-remote: unable to fork off fetch subprocess" err && > > This part seems quite odd, we tested the exit code, so here we're being > paranoid about not getting a specific "fatal" error message. > > It seems more worthwhile to test the warnings we emit, which in this > case seem to be duplicated (but that's probably an existing issue...). > So you mean the grep here is redundant? > > > + grep "git fetch origin" trace.txt >actual && > > + test_line_count = 1 actual > > +' > > I wondered if "test_subcomand" here would be better, i.e. fewer things > scraping GIT_TRACE, and using the machine-readable GIT_TRACE2_EVENT > instead... I threw this question up front but got no response. When using test_subcommand() we should give all the args, if we remove or add any args later, this test case will always pass even without this fix. So, is this test case still strict? GIT_TRACE2_EVENT="$(PWD)/trace.txt" \ git -C with-commit-graph fetch origin $anycommit && test_subcommand ! git -c fetch.negotiationAlgorithm=noop \ fetch origin --no-tags --no-write-fetch-head \ --recurse-submodules=no --filter=blob:none \ --stdin <trace.txt Existing usages are as follows, and they all have fewer parameters: test_subcommand ! git gc --quiet <run-config.txt && test_subcommand ! git multi-pack-index write --no-progress <trace-A test_subcommand ! git pack-refs --all --prune \ <incremental-daily.txt && Thanks -Han Xin