From: Jeff King Date: Thu, 09 Nov 2023 18:56:42 GMT Subject: Re: [PATCH 3/4] contrib/subtree: convert subtree type check to use case statement Message-ID: <20231109185642.GE2711684@coredump.intra.peff.net> In-Reply-To: <7c54d9070fac15b8f0504251d920d0e1fc1fb1f4.1699526999.git.ps@pks.im> On Thu, Nov 09, 2023 at 11:53:39AM +0100, Patrick Steinhardt wrote: > The `subtree_for_commit ()` helper function asserts that the subtree > identified by its parameters are either a commit or tree. This is done > via the `-o` parameter of test, which is discouraged. > > Refactor the code to instead use a switch statement over the type. > Despite being aligned with our coding guidelines, the resulting code is > arguably also easier to read. Yes, I'd agree that the result is much easier to follow. -Peff