Thread (6 messages) flat view 6 messages, 5 authors, 2025-08-07

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

From: Patrick Steinhardt <hidden>
Date: 2025-08-07 04:38:13

Possibly related (same subject, not in this thread)

On Wed, Aug 06, 2025 at 09:30:20PM -0700, Denton Liu wrote:
quoted hunk ↗ jump to hunk
For better readability, convert the if-else tower into a switch
statement.

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