blob: ca1f94e2d2ed90f9ef4c588e27c0d8e15e1724ab [file] [log] [blame]
Heiko Voigt959b5452015-08-17 17:21:57 -07001#ifndef SUBMODULE_CONFIG_CACHE_H
2#define SUBMODULE_CONFIG_CACHE_H
3
brian m. carlson34caab02018-05-02 00:25:42 +00004#include "cache.h"
Heiko Voigt959b5452015-08-17 17:21:57 -07005#include "hashmap.h"
Stefan Bellerea2fa5a2016-02-29 18:07:11 -08006#include "submodule.h"
Heiko Voigt959b5452015-08-17 17:21:57 -07007#include "strbuf.h"
8
9/*
10 * Submodule entry containing the information about a certain submodule
11 * in a certain revision.
12 */
13struct submodule {
14 const char *path;
15 const char *name;
16 const char *url;
17 int fetch_recurse;
18 const char *ignore;
Stefan Bellerb5944f32016-07-28 17:44:07 -070019 const char *branch;
Stefan Bellerea2fa5a2016-02-29 18:07:11 -080020 struct submodule_update_strategy update_strategy;
brian m. carlson34caab02018-05-02 00:25:42 +000021 /* the object id of the responsible .gitmodules file */
22 struct object_id gitmodules_oid;
Stefan Beller37f52e92016-05-26 14:59:42 -070023 int recommend_shallow;
Heiko Voigt959b5452015-08-17 17:21:57 -070024};
25
Heiko Voigtc68f8372017-10-16 15:58:27 +020026#define SUBMODULE_INIT { NULL, NULL, NULL, RECURSE_SUBMODULES_NONE, \
brian m. carlson34caab02018-05-02 00:25:42 +000027 NULL, NULL, SUBMODULE_UPDATE_STRATEGY_INIT, { { 0 } }, -1 };
Heiko Voigtc68f8372017-10-16 15:58:27 +020028
Brandon Williamsbf12fcd2017-06-22 11:43:44 -070029struct submodule_cache;
30struct repository;
31
32extern void submodule_cache_free(struct submodule_cache *cache);
33
Brandon Williamsf20e7c12017-08-02 12:49:18 -070034extern int parse_submodule_fetchjobs(const char *var, const char *value);
Stefan Bellerd601fd02017-03-14 14:46:32 -070035extern int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg);
Stefan Beller886dc152017-06-23 12:13:00 -070036struct option;
37extern int option_fetch_parse_recurse_submodules(const struct option *opt,
38 const char *arg, int unset);
Stefan Bellerd601fd02017-03-14 14:46:32 -070039extern int parse_update_recurse_submodules_arg(const char *opt, const char *arg);
40extern int parse_push_recurse_submodules_arg(const char *opt, const char *arg);
Brandon Williams1b796ac2017-08-03 11:19:57 -070041extern void repo_read_gitmodules(struct repository *repo);
42extern void gitmodules_config_oid(const struct object_id *commit_oid);
Stefan Beller3b8fb392018-03-28 15:35:29 -070043const struct submodule *submodule_from_name(struct repository *r,
44 const struct object_id *commit_or_tree,
45 const char *name);
46const struct submodule *submodule_from_path(struct repository *r,
47 const struct object_id *commit_or_tree,
48 const char *path);
Stefan Bellerf793b892018-03-28 15:35:28 -070049void submodule_free(struct repository *r);
Heiko Voigt959b5452015-08-17 17:21:57 -070050
Jeff King0383bbb2018-04-30 03:25:25 -040051/*
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 */
56int check_submodule_name(const char *name);
57
Heiko Voigt959b5452015-08-17 17:21:57 -070058#endif /* SUBMODULE_CONFIG_H */