summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-08-31 23:18:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-09-02 16:16:24 (GMT)
commit6870cdc32aaa2b5786b77898522d932cf592a7f1 (patch)
tree5a655eb8b1466d10c93f202f01bed8766b52bd8a /tree.c
parentb9dd63ffe2842fe676f54d4d5f8f06bc04c6dd8b (diff)
downloadgit-6870cdc32aaa2b5786b77898522d932cf592a7f1.zip
git-6870cdc32aaa2b5786b77898522d932cf592a7f1.tar.gz
git-6870cdc32aaa2b5786b77898522d932cf592a7f1.tar.bz2
submodule--helper: use "code" in run_update_command()
Apply some DRY principles in run_update_command() and don't have two "switch" statements over "ud->update_strategy.type" determine the same thing. First we were setting "must_die_on_failure = 1" in all cases except "SM_UPDATE_CHECKOUT" (and we'd BUG(...) out on the rest). This code was added in c51f8f94e5b (submodule--helper: run update procedures from C, 2021-08-24). Then we'd duplicate same "switch" logic when we were using the "must_die_on_failure" variable. Let's instead have the "case" branches in that inner "switch" determine whether or not the "update must continue" by picking an exit code. This also mostly avoids hardcoding the "128" exit code, instead we can make use of the return value of the die_message() function, which we've been calling here since 55b3f12cb54 (submodule update: use die_message(), 2022-03-15). We're still hardcoding it to determine if we "exit()", but subsequent commit(s) will address that. 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>
Diffstat (limited to 'tree.c')
0 files changed, 0 insertions, 0 deletions