submodule--helper: don't overlay config in update-clone
Don't rely on overlaying the repository's config on top of the submodule-config, instead query the repository's config directly for the url and the update strategy configuration. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
177257ccc7
commit
ec6141a0f2
38
submodule.c
38
submodule.c
@ -398,24 +398,38 @@ void die_path_inside_submodule(const struct index_state *istate,
|
||||
}
|
||||
}
|
||||
|
||||
enum submodule_update_type parse_submodule_update_type(const char *value)
|
||||
{
|
||||
if (!strcmp(value, "none"))
|
||||
return SM_UPDATE_NONE;
|
||||
else if (!strcmp(value, "checkout"))
|
||||
return SM_UPDATE_CHECKOUT;
|
||||
else if (!strcmp(value, "rebase"))
|
||||
return SM_UPDATE_REBASE;
|
||||
else if (!strcmp(value, "merge"))
|
||||
return SM_UPDATE_MERGE;
|
||||
else if (*value == '!')
|
||||
return SM_UPDATE_COMMAND;
|
||||
else
|
||||
return SM_UPDATE_UNSPECIFIED;
|
||||
}
|
||||
|
||||
int parse_submodule_update_strategy(const char *value,
|
||||
struct submodule_update_strategy *dst)
|
||||
{
|
||||
enum submodule_update_type type;
|
||||
|
||||
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
|
||||
|
||||
type = parse_submodule_update_type(value);
|
||||
if (type == SM_UPDATE_UNSPECIFIED)
|
||||
return -1;
|
||||
|
||||
dst->type = type;
|
||||
if (type == SM_UPDATE_COMMAND)
|
||||
dst->command = xstrdup(value + 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user