submodule--helper: return "ret", not "1" from update_submodule()

Amend the update_submodule() function to return the failing "ret" on error, instead of overriding it with "1". This code was added in b3c5f5cb048 (submodule: move core cmd_update() logic to C, 2022-03-15), and this change ends up not making a difference as this function is only called in update_submodules(). If we return non-zero here we'll always in turn return "1" in module_update(). But if we didn't do that and returned any other non-zero exit code in update_submodules() we'd fail the test that's being amended here. We're still testing the status quo here. This change makes subsequent refactoring of update_submodule() easier, as we'll no longer need to worry about clobbering the "ret" we get from the run_command(). 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 0b917a9f5cb21ca1655daf549108361602e912f3
2 files changed +2 -2
builtin/submodule--helper.c
+1 -1
@@ -2445,7 +2445,7 @@ static int update_submodule(struct update_data *update_data)
2445 update_data->displaypath);
2446 if (ret == 128)
2447 exit(ret);
2448 - return 1;
2448 + return ret;
2449 }
2450
2451 return 0;
t/t7406-submodule-update.sh
+1 -1
@@ -769,7 +769,7 @@ test_expect_success 'submodule update continues after recursive checkout error'
769 echo "" > file
770 )
771 ) &&
772 - test_must_fail git submodule update --recursive &&
772 + test_expect_code 1 git submodule update --recursive &&
773 (cd submodule2 &&
774 git rev-parse --verify HEAD >../actual
775 ) &&