Subject: Re: [PATCH] remote.c: convert if-else tower to switch

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 7 Aug 2025 06:38:06 +0200

On Wed, Aug 06, 2025 at 09:30:20PM -0700, Denton Liu wrote:
> For better readability, convert the if-else tower into a switch
> statement.
> 
> Signed-off-by: Denton Liu <[email-masked]>
> ---
> Thanks for the suggestion, both. Please queue this patch wherever it
> makes the most sense to do so (either with the existing series or on its
> own separate branch).
> 
>  remote.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/remote.c b/remote.c
> index 465e0ea0eb..c7ae18fcfa 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -1197,29 +1197,35 @@ static void show_push_unqualified_ref_name_error(const char *dst_value,
>  		    "match_explicit_lhs() should catch this!",
>  		    matched_src_name);
>  	type = odb_read_object_info(the_repository->objects, &oid, NULL);

Nit: we can also drop the `type` variable, we don't need it for anything
but the value of the switch as far as I can see.

Thanks!

Patrick