Sync with Git 2.15.2
[git/git.git] / submodule-config.h
1 #ifndef SUBMODULE_CONFIG_CACHE_H
2 #define SUBMODULE_CONFIG_CACHE_H
3
4 #include "hashmap.h"
5 #include "submodule.h"
6 #include "strbuf.h"
7
8 /*
9 * Submodule entry containing the information about a certain submodule
10 * in a certain revision.
11 */
12 struct submodule {
13 const char *path;
14 const char *name;
15 const char *url;
16 int fetch_recurse;
17 const char *ignore;
18 const char *branch;
19 struct submodule_update_strategy update_strategy;
20 /* the sha1 blob id of the responsible .gitmodules file */
21 unsigned char gitmodules_sha1[20];
22 int recommend_shallow;
23 };
24
25 #define SUBMODULE_INIT { NULL, NULL, NULL, RECURSE_SUBMODULES_NONE, \
26 NULL, NULL, SUBMODULE_UPDATE_STRATEGY_INIT, {0}, -1 };
27
28 struct submodule_cache;
29 struct repository;
30
31 extern void submodule_cache_free(struct submodule_cache *cache);
32
33 extern int parse_submodule_fetchjobs(const char *var, const char *value);
34 extern int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg);
35 struct option;
36 extern int option_fetch_parse_recurse_submodules(const struct option *opt,
37 const char *arg, int unset);
38 extern int parse_update_recurse_submodules_arg(const char *opt, const char *arg);
39 extern int parse_push_recurse_submodules_arg(const char *opt, const char *arg);
40 extern void repo_read_gitmodules(struct repository *repo);
41 extern void gitmodules_config_oid(const struct object_id *commit_oid);
42 extern const struct submodule *submodule_from_name(
43 const struct object_id *commit_or_tree, const char *name);
44 extern const struct submodule *submodule_from_path(
45 const struct object_id *commit_or_tree, const char *path);
46 extern const struct submodule *submodule_from_cache(struct repository *repo,
47 const struct object_id *treeish_name,
48 const char *key);
49 extern void submodule_free(void);
50
51 /*
52 * Returns 0 if the name is syntactically acceptable as a submodule "name"
53 * (e.g., that may be found in the subsection of a .gitmodules file) and -1
54 * otherwise.
55 */
56 int check_submodule_name(const char *name);
57
58 #endif /* SUBMODULE_CONFIG_H */