Re: [PATCH v3 1/2] t: add a test helper for getting hostname
- From
Jeff King <peff@peff.net>
- Date
- Mar 19, 2024, 21:11 UTC
- Message-ID
- <20240319211112.GD1159535@coredump.intra.peff.net>
- In-Reply-To
- <xmqqo7balyx9.fsf@gitster.g>
On Tue, Mar 19, 2024 at 02:00:34PM -0700, Junio C Hamano wrote:
Show 12 quoted lines
> Jeff King <peff@peff.net> writes: > > > I think you need to lose the exit status. Or alternatively do: > > > > hostname=$(test-tool xgethostname || echo unknown) > > > > See my other reply. > > As "test-tool xgethostname" runs exactly the same codepath as > "includeIf hostname:blah" feature, I would actually prefer for a > failing "test-tool gethostname" to _break_ this test so that people > can take notice.
But we are not testing "includeIf" in this patch; we are testing git-gc, which falls back to the string "unknown". The includeIf tests in patch 2 will naturally fail if either xgethostname() fails (because then we will refuse to do any host matching) or if it works but somehow test-tool is broken (because then it won't match what the config code sees internally).
-Peff