| Johannes Schindelin | 752c0c2 | 2009-10-19 12:38:32 | [diff] [blame] | 1 | #ifndef SUBMODULE_H |
| 2 | #define SUBMODULE_H |
| 3 | |
| Jens Lehmann | 46a958b | 2010-06-25 14:56:47 | [diff] [blame] | 4 | struct diff_options; |
| Jens Lehmann | 50d89ad | 2012-09-01 15:27:06 | [diff] [blame] | 5 | struct argv_array; |
| Jens Lehmann | 46a958b | 2010-06-25 14:56:47 | [diff] [blame] | 6 | |
| Jens Lehmann | 88a2197 | 2011-03-06 22:10:46 | [diff] [blame] | 7 | enum { |
| Mike Crowe | b33a15b | 2015-11-17 11:05:56 | [diff] [blame] | 8 | RECURSE_SUBMODULES_CHECK = -4, |
| Heiko Voigt | 027771f | 2015-08-18 00:22:00 | [diff] [blame] | 9 | RECURSE_SUBMODULES_ERROR = -3, |
| Heiko Voigt | 959b545 | 2015-08-18 00:21:57 | [diff] [blame] | 10 | RECURSE_SUBMODULES_NONE = -2, |
| Jens Lehmann | 88a2197 | 2011-03-06 22:10:46 | [diff] [blame] | 11 | RECURSE_SUBMODULES_ON_DEMAND = -1, |
| 12 | RECURSE_SUBMODULES_OFF = 0, |
| 13 | RECURSE_SUBMODULES_DEFAULT = 1, |
| 14 | RECURSE_SUBMODULES_ON = 2 |
| 15 | }; |
| 16 | |
| Stefan Beller | ea2fa5a | 2016-03-01 02:07:11 | [diff] [blame] | 17 | enum submodule_update_type { |
| 18 | SM_UPDATE_UNSPECIFIED = 0, |
| 19 | SM_UPDATE_CHECKOUT, |
| 20 | SM_UPDATE_REBASE, |
| 21 | SM_UPDATE_MERGE, |
| 22 | SM_UPDATE_NONE, |
| 23 | SM_UPDATE_COMMAND |
| 24 | }; |
| 25 | |
| 26 | struct submodule_update_strategy { |
| 27 | enum submodule_update_type type; |
| 28 | const char *command; |
| 29 | }; |
| Stefan Beller | a028a19 | 2016-03-01 02:07:13 | [diff] [blame] | 30 | #define SUBMODULE_UPDATE_STRATEGY_INIT {SM_UPDATE_UNSPECIFIED, NULL} |
| Stefan Beller | ea2fa5a | 2016-03-01 02:07:11 | [diff] [blame] | 31 | |
| Jens Lehmann | 5fee995 | 2013-07-30 19:50:34 | [diff] [blame] | 32 | int is_staging_gitmodules_ok(void); |
| Jens Lehmann | 0656781 | 2013-08-06 19:15:11 | [diff] [blame] | 33 | int update_path_in_gitmodules(const char *oldpath, const char *newpath); |
| Jens Lehmann | 95c1641 | 2013-08-06 19:15:25 | [diff] [blame] | 34 | int remove_path_from_gitmodules(const char *path); |
| Jens Lehmann | 5fee995 | 2013-07-30 19:50:34 | [diff] [blame] | 35 | void stage_updated_gitmodules(void); |
| Jens Lehmann | aee9c7d | 2010-08-05 22:39:25 | [diff] [blame] | 36 | void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt, |
| 37 | const char *path); |
| Jens Lehmann | 7dce19d | 2010-11-12 12:54:52 | [diff] [blame] | 38 | int submodule_config(const char *var, const char *value, void *cb); |
| René Scharfe | c2df758 | 2012-04-10 19:10:26 | [diff] [blame] | 39 | void gitmodules_config(void); |
| Stefan Beller | ea2fa5a | 2016-03-01 02:07:11 | [diff] [blame] | 40 | int parse_submodule_update_strategy(const char *value, |
| 41 | struct submodule_update_strategy *dst); |
| Stefan Beller | 3604242 | 2016-04-16 00:50:13 | [diff] [blame] | 42 | const char *submodule_strategy_to_string(const struct submodule_update_strategy *s); |
| Jens Lehmann | 46a958b | 2010-06-25 14:56:47 | [diff] [blame] | 43 | void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *); |
| Johannes Schindelin | 752c0c2 | 2009-10-19 12:38:32 | [diff] [blame] | 44 | void show_submodule_summary(FILE *f, const char *path, |
| John Keeping | 0f33a06 | 2013-04-05 16:12:08 | [diff] [blame] | 45 | const char *line_prefix, |
| Johannes Schindelin | 752c0c2 | 2009-10-19 12:38:32 | [diff] [blame] | 46 | unsigned char one[20], unsigned char two[20], |
| Ramkumar Ramachandra | 4e21513 | 2012-11-13 15:42:47 | [diff] [blame] | 47 | unsigned dirty_submodule, const char *meta, |
| Johannes Schindelin | 752c0c2 | 2009-10-19 12:38:32 | [diff] [blame] | 48 | const char *del, const char *add, const char *reset); |
| Jens Lehmann | be254a0 | 2010-11-10 23:55:02 | [diff] [blame] | 49 | void set_config_fetch_recurse_submodules(int value); |
| Jens Lehmann | 88a2197 | 2011-03-06 22:10:46 | [diff] [blame] | 50 | void check_for_new_submodule_commits(unsigned char new_sha1[20]); |
| Jens Lehmann | 50d89ad | 2012-09-01 15:27:06 | [diff] [blame] | 51 | int fetch_populated_submodules(const struct argv_array *options, |
| Jens Lehmann | 8f0700d | 2011-03-06 22:11:21 | [diff] [blame] | 52 | const char *prefix, int command_line_option, |
| Stefan Beller | 62104ba | 2015-12-16 00:04:12 | [diff] [blame] | 53 | int quiet, int max_parallel_jobs); |
| Jens Lehmann | 3bfc450 | 2010-03-13 22:00:27 | [diff] [blame] | 54 | unsigned is_submodule_modified(const char *path, int ignore_untracked); |
| Jens Lehmann | 293ab15 | 2012-09-26 18:21:13 | [diff] [blame] | 55 | int submodule_uses_gitfile(const char *path); |
| 56 | int ok_to_remove_submodule(const char *path); |
| Heiko Voigt | 68d03e4 | 2010-07-07 13:39:13 | [diff] [blame] | 57 | int merge_submodule(unsigned char result[20], const char *path, const unsigned char base[20], |
| Brad King | 8098878 | 2011-10-13 12:59:05 | [diff] [blame] | 58 | const unsigned char a[20], const unsigned char b[20], int search); |
| Heiko Voigt | a762e51 | 2012-03-29 07:21:23 | [diff] [blame] | 59 | int find_unpushed_submodules(unsigned char new_sha1[20], const char *remotes_name, |
| 60 | struct string_list *needs_pushing); |
| Heiko Voigt | eb21c73 | 2012-03-29 07:21:24 | [diff] [blame] | 61 | int push_unpushed_submodules(unsigned char new_sha1[20], const char *remotes_name); |
| Jens Lehmann | a88c915 | 2013-07-30 19:50:03 | [diff] [blame] | 62 | void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir); |
| Stefan Beller | a028a19 | 2016-03-01 02:07:13 | [diff] [blame] | 63 | int parallel_submodules(void); |
| Johannes Schindelin | 752c0c2 | 2009-10-19 12:38:32 | [diff] [blame] | 64 | |
| Jeff King | 4638728 | 2016-04-28 13:38:20 | [diff] [blame] | 65 | /* |
| Jeff King | 4638728 | 2016-04-28 13:38:20 | [diff] [blame] | 66 | * Prepare the "env_array" parameter of a "struct child_process" for executing |
| 67 | * a submodule by clearing any repo-specific envirionment variables, but |
| Jeff King | 89044ba | 2016-05-05 01:22:19 | [diff] [blame] | 68 | * retaining any config in the environment. |
| Jeff King | 4638728 | 2016-04-28 13:38:20 | [diff] [blame] | 69 | */ |
| 70 | void prepare_submodule_repo_env(struct argv_array *out); |
| 71 | |
| Johannes Schindelin | 752c0c2 | 2009-10-19 12:38:32 | [diff] [blame] | 72 | #endif |