submodule--helper: don't call submodule_strategy_to_string() in BUG()

Don't call submodule_strategy_to_string() in a BUG() message. These calls added in c51f8f94e5b (submodule--helper: run update procedures from C, 2021-08-24) don't need the extra information submodule_strategy_to_string() gives us, as we'll never reach the SM_UPDATE_COMMAND case here. That case is the only one where we'd get any information beyond the straightforward number-to-string mapping. 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 08c2e778d6b16296aebfccd609ad09db9d40764a
1 file changed +6 -6
builtin/submodule--helper.c
+6 -6
@@ -2156,8 +2156,8 @@ static int run_update_command(const struct update_data *ud, int subforce)
2156 must_die_on_failure = 1;
2157 break;
2158 default:
2159 - BUG("unexpected update strategy type: %s",
2160 - submodule_strategy_to_string(&ud->update_strategy));
2159 + BUG("unexpected update strategy type: %d",
2160 + ud->update_strategy.type);
2161 }
2162 strvec_push(&cp.args, oid);
2163
@@ -2182,8 +2182,8 @@ static int run_update_command(const struct update_data *ud, int subforce)
2182 ud->update_strategy.command, oid, ud->displaypath);
2183 break;
2184 default:
2185 - BUG("unexpected update strategy type: %s",
2186 - submodule_strategy_to_string(&ud->update_strategy));
2185 + BUG("unexpected update strategy type: %d",
2186 + ud->update_strategy.type);
2187 }
2188 if (must_die_on_failure)
2189 exit(128);
@@ -2213,8 +2213,8 @@ static int run_update_command(const struct update_data *ud, int subforce)
2213 ud->displaypath, ud->update_strategy.command, oid);
2214 break;
2215 default:
2216 - BUG("unexpected update strategy type: %s",
2217 - submodule_strategy_to_string(&ud->update_strategy));
2216 + BUG("unexpected update strategy type: %d",
2217 + ud->update_strategy.type);
2218 }
2219
2220 return 0;