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>
This commit is contained in:
committed by
Junio C Hamano
parent
2a73b3dad0
commit
ea2fa5a338
21
submodule.c
21
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user