From: Han Xin Date: Wed, 13 Jul 2022 01:26:50 GMT Subject: Re: Re: [PATCH v5 1/1] commit-graph.c: no lazy fetch in lookup_commit_in_graph() Message-ID: In-Reply-To: <220712.86zghe4q0c.gmgdl@evledraar.gmail.com> On Tue, Jul 12, 2022 at 5:52 PM Ævar Arnfjörð Bjarmason 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