[PATCH v2 17/28] submodule--helper: don't redundantly check "else if (res)"
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Aug 2, 2022, 15:46 UTC
- Message-ID
- <patch-v2-17.28-23eb07176d9-20220802T154036Z-avarab@gmail.com>
- In-Reply-To
- <cover-v2-00.28-00000000000-20220802T154036Z-avarab@gmail.com>
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 an 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> --- builtin/submodule--helper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 5ea308273f4..1a19723f596 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2443,8 +2443,7 @@ static int update_submodule(struct update_data *update_data) update_data->displaypath); if (res == 128) exit(res); - else if (res) - return 1; + return 1; } return 0;
-- 2.37.1.1233.ge8b09efaedc