submodule--helper: don't redundantly check "else if (res)"
The "res" variable must be true at this point in update_submodule(), as just a few lines above this we've unconditionally: if (!res) return 0; So we don't need to guard the "return 1" with an "else if (res)", we can return unconditionally at this point. See b3c5f5cb048 (submodule: move core cmd_update() logic to C, 2022-03-15) for the initial introduction of this code, this check of "res" has always been redundant. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Sep 1, 2022 at 01:18 UTC
b0bff0be5463ebfb75a76ff8577b90ade439a437
1 file changed
+1
-2
builtin/submodule--helper.c
+1
-2
@@ -2445,8 +2445,7 @@ static int update_submodule(struct update_data *update_data)
2445
update_data->displaypath);
2446
if (res == 128)
2447
exit(res);
2448
- else if (res)
2449
- return 1;
2448
+ return 1;
2449
}
2450
2451
return 0;