diff options
| author | Junio C Hamano <gitster@pobox.com> | 2016-05-17 14:38:16 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2016-05-17 14:38:17 -0700 |
| commit | f2c96ceb57afd8c64c3e3e656f9390c95e9fbec9 (patch) | |
| tree | b791b78d9dd9edb23dff810c1275b6f27671f742 /submodule.c | |
| parent | Twelfth batch for 2.9 (diff) | |
| parent | submodule init: redirect stdout to stderr (diff) | |
| download | git-f2c96ceb57afd8c64c3e3e656f9390c95e9fbec9.tar.gz git-f2c96ceb57afd8c64c3e3e656f9390c95e9fbec9.zip | |
Merge branch 'sb/submodule-init'
Update of "git submodule" to move pieces of logic to C continues.
* sb/submodule-init:
submodule init: redirect stdout to stderr
submodule--helper update-clone: abort gracefully on missing .gitmodules
submodule init: fail gracefully with a missing .gitmodules file
submodule: port init from shell to C
submodule: port resolve_relative_url from shell to C
Diffstat (limited to 'submodule.c')
| -rw-r--r-- | submodule.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c index 90825e17fa..4cc1c27931 100644 --- a/submodule.c +++ b/submodule.c @@ -237,6 +237,27 @@ int parse_submodule_update_strategy(const char *value, return 0; } +const char *submodule_strategy_to_string(const struct submodule_update_strategy *s) +{ + struct strbuf sb = STRBUF_INIT; + switch (s->type) { + case SM_UPDATE_CHECKOUT: + return "checkout"; + case SM_UPDATE_MERGE: + return "merge"; + case SM_UPDATE_REBASE: + return "rebase"; + 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); + } + return NULL; +} + void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *arg) { |
