[PATCH v3 2/8] git: make the two loops look more symmetric
- From
- kristofferhaugsbakk@fastmail.com <kristofferhaugsbakk@fastmail.com>
- Date
- Sep 8, 2025, 15:36 UTC
- Message-ID
- <183dd68d09d7785b449f0c5295094690f7f35509.1757345711.git.code@khaugsbakk.name>
- In-Reply-To
- <cover.1757345711.git.code@khaugsbakk.name>
From: Kristoffer Haugsbakk <code@khaugsbakk.name>
Rewrite the original conditional here to match the new sibling loop in structure.
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> ---
Notes (series):
v3 (new):
This is just a refactor commit to avoid having to add a “while at it”
for such small tweaks for the new context.git.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/git.c b/git.c index 87d61f12594..39dc9f8ec0f 100644 --- a/git.c +++ b/git.c @@ -686,11 +686,9 @@ static void list_builtins(struct string_list *out, unsigned int include_option, if (commands[i].option & include_option) string_list_append(out, commands[i].cmd); } else { - for (size_t i = 0; i < ARRAY_SIZE(commands); i++) { - if (commands[i].option & exclude_option) - continue; - string_list_append(out, commands[i].cmd); - } + for (size_t i = 0; i < ARRAY_SIZE(commands); i++) + if (!(commands[i].option & exclude_option)) + string_list_append(out, commands[i].cmd); } }
-- 2.51.0.16.gcd94ab5bf81