зеркало из https://github.com/microsoft/git.git
update submodules: add submodule config parsing
Similar tob33a15b08
(push: add recurseSubmodules config option, 2015-11-17) and027771fcb1
(submodule: allow erroneous values for the fetchRecurseSubmodules option, 2015-08-17), we add submodule-config code that is later used to parse whether we are interested in updating submodules. We need the `die_on_error` parameter to be able to call this parsing function for the config file as well, which if incorrect lets Git die. As we're just touching the header file, also mark all functions extern. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
15cdc64776
Коммит
d601fd0957
|
@ -234,6 +234,26 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg)
|
||||||
return parse_fetch_recurse(opt, arg, 1);
|
return parse_fetch_recurse(opt, arg, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int parse_update_recurse(const char *opt, const char *arg,
|
||||||
|
int die_on_error)
|
||||||
|
{
|
||||||
|
switch (git_config_maybe_bool(opt, arg)) {
|
||||||
|
case 1:
|
||||||
|
return RECURSE_SUBMODULES_ON;
|
||||||
|
case 0:
|
||||||
|
return RECURSE_SUBMODULES_OFF;
|
||||||
|
default:
|
||||||
|
if (die_on_error)
|
||||||
|
die("bad %s argument: %s", opt, arg);
|
||||||
|
return RECURSE_SUBMODULES_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int parse_update_recurse_submodules_arg(const char *opt, const char *arg)
|
||||||
|
{
|
||||||
|
return parse_update_recurse(opt, arg, 1);
|
||||||
|
}
|
||||||
|
|
||||||
static int parse_push_recurse(const char *opt, const char *arg,
|
static int parse_push_recurse(const char *opt, const char *arg,
|
||||||
int die_on_error)
|
int die_on_error)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,16 +22,17 @@ struct submodule {
|
||||||
int recommend_shallow;
|
int recommend_shallow;
|
||||||
};
|
};
|
||||||
|
|
||||||
int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg);
|
extern int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg);
|
||||||
int parse_push_recurse_submodules_arg(const char *opt, const char *arg);
|
extern int parse_update_recurse_submodules_arg(const char *opt, const char *arg);
|
||||||
int parse_submodule_config_option(const char *var, const char *value);
|
extern int parse_push_recurse_submodules_arg(const char *opt, const char *arg);
|
||||||
const struct submodule *submodule_from_name(const unsigned char *commit_or_tree,
|
extern int parse_submodule_config_option(const char *var, const char *value);
|
||||||
const char *name);
|
extern const struct submodule *submodule_from_name(
|
||||||
const struct submodule *submodule_from_path(const unsigned char *commit_or_tree,
|
const unsigned char *commit_or_tree, const char *name);
|
||||||
const char *path);
|
extern const struct submodule *submodule_from_path(
|
||||||
|
const unsigned char *commit_or_tree, const char *path);
|
||||||
extern int gitmodule_sha1_from_commit(const unsigned char *commit_sha1,
|
extern int gitmodule_sha1_from_commit(const unsigned char *commit_sha1,
|
||||||
unsigned char *gitmodules_sha1,
|
unsigned char *gitmodules_sha1,
|
||||||
struct strbuf *rev);
|
struct strbuf *rev);
|
||||||
void submodule_free(void);
|
extern void submodule_free(void);
|
||||||
|
|
||||||
#endif /* SUBMODULE_CONFIG_H */
|
#endif /* SUBMODULE_CONFIG_H */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче