diff options
author | Stefan Beller <sbeller@google.com> | 2016-02-29 18:07:11 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-03-01 11:57:17 -0800 |
commit | ea2fa5a3388281b880ae2aa75c8eac0d4b1a6c69 (patch) | |
tree | 58f08091493d1d942a21f04ee6f7b8219f4224bf /submodule.c | |
parent | 2a73b3dad09ef162eb5917e9e0d01d7c306f6b35 (diff) | |
download | git-ea2fa5a3388281b880ae2aa75c8eac0d4b1a6c69.tar.gz git-ea2fa5a3388281b880ae2aa75c8eac0d4b1a6c69.tar.xz |
submodule-config: keep update strategy around
Currently submodule.<name>.update is only handled by git-submodule.sh.
C code will start to need to make use of that value as more of the
functionality of git-submodule.sh moves into library code in C.
Add the update field to 'struct submodule' and populate it so it can
be read as sm->update or from sm->update_command.
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 916fc84aa..c3a1300a5 100644 --- a/submodule.c +++ b/submodule.c @@ -210,6 +210,27 @@ void gitmodules_config(void) } } +int parse_submodule_update_strategy(const char *value, + struct submodule_update_strategy *dst) +{ + free((void*)dst->command); + dst->command = NULL; + if (!strcmp(value, "none")) + dst->type = SM_UPDATE_NONE; + else if (!strcmp(value, "checkout")) + dst->type = SM_UPDATE_CHECKOUT; + else if (!strcmp(value, "rebase")) + dst->type = SM_UPDATE_REBASE; + else if (!strcmp(value, "merge")) + dst->type = SM_UPDATE_MERGE; + else if (skip_prefix(value, "!", &value)) { + dst->type = SM_UPDATE_COMMAND; + dst->command = xstrdup(value); + } else + return -1; + return 0; +} + void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *arg) { |