diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-09-13 11:38:23 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-09-13 11:38:23 -0700 |
| commit | f322e9f51b5a2ca303a6691d0e2d1f3f754923ff (patch) | |
| tree | 854b7f33b056c6233b10e7e7e164c3bb6fb34f76 /submodule.c | |
| parent | 04791386457e48220ee4388b9b3b51e36203d8c1 (diff) | |
| parent | d4a492f4ad0455710a7db8c589f4865810b0d0b7 (diff) | |
| download | git-f322e9f51b5a2ca303a6691d0e2d1f3f754923ff.tar.xz | |
Merge branch 'ab/submodule-helper-prep'
Code clean-up of "git submodule--helper".
* ab/submodule-helper-prep: (33 commits)
submodule--helper: fix bad config API usage
submodule--helper: libify even more "die" paths for module_update()
submodule--helper: libify more "die" paths for module_update()
submodule--helper: check repo{_submodule,}_init() return values
submodule--helper: libify "must_die_on_failure" code paths (for die)
submodule--helper update: don't override 'checkout' exit code
submodule--helper: libify "must_die_on_failure" code paths
submodule--helper: libify determine_submodule_update_strategy()
submodule--helper: don't exit() on failure, return
submodule--helper: use "code" in run_update_command()
submodule API: don't handle SM_..{UNSPECIFIED,COMMAND} in to_string()
submodule--helper: don't call submodule_strategy_to_string() in BUG()
submodule--helper: add missing braces to "else" arm
submodule--helper: return "ret", not "1" from update_submodule()
submodule--helper: rename "int res" to "int ret"
submodule--helper: don't redundantly check "else if (res)"
submodule--helper: refactor "errmsg_str" to be a "struct strbuf"
submodule--helper: add "const" to passed "struct update_data"
submodule--helper: add "const" to copy of "update_data"
submodule--helper: add "const" to passed "module_clone_data"
...
Diffstat (limited to 'submodule.c')
| -rw-r--r-- | submodule.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/submodule.c b/submodule.c index 3fa5db3ecd..1ebda30c50 100644 --- a/submodule.c +++ b/submodule.c @@ -415,10 +415,9 @@ int parse_submodule_update_strategy(const char *value, return 0; } -const char *submodule_strategy_to_string(const struct submodule_update_strategy *s) +const char *submodule_update_type_to_string(enum submodule_update_type type) { - struct strbuf sb = STRBUF_INIT; - switch (s->type) { + switch (type) { case SM_UPDATE_CHECKOUT: return "checkout"; case SM_UPDATE_MERGE: @@ -428,12 +427,11 @@ const char *submodule_strategy_to_string(const struct submodule_update_strategy case SM_UPDATE_NONE: return "none"; case SM_UPDATE_UNSPECIFIED: - return NULL; case SM_UPDATE_COMMAND: - strbuf_addf(&sb, "!%s", s->command); - return strbuf_detach(&sb, NULL); + BUG("init_submodule() should handle type %d", type); + default: + BUG("unexpected update strategy type: %d", type); } - return NULL; } void handle_ignore_submodules_arg(struct diff_options *diffopt, |
