Thread (15 messages) 15 messages, 2 authors, 2023-11-10

Re: [PATCH 3/4] contrib/subtree: convert subtree type check to use case statement

From: Jeff King <hidden>
Date: 2023-11-09 18:56:44

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help