push: propagate remote and refspec with --recurse-submodules

Teach "push --recurse-submodules" to propagate, if given a name as remote, the
provided remote and refspec recursively to the pushes performed in the
submodules. The push will therefore only succeed if all submodules have a
remote with such a name configured.

Note that "push --recurse-submodules" with a path or URL as remote will not
propagate the remote or refspec and instead use the default remote and refspec
configured in the submodule, preserving the current behavior.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brandon Williams
2017-04-05 10:47:19 -07:00
committed by Junio C Hamano
parent 93481a6b89
commit 06bf4ad1db
4 changed files with 117 additions and 5 deletions

View File

@ -4,6 +4,7 @@
struct diff_options;
struct argv_array;
struct sha1_array;
struct remote;
enum {
RECURSE_SUBMODULES_ONLY = -5,
@ -91,7 +92,8 @@ extern int find_unpushed_submodules(struct sha1_array *commits,
const char *remotes_name,
struct string_list *needs_pushing);
extern int push_unpushed_submodules(struct sha1_array *commits,
const char *remotes_name,
const struct remote *remote,
const char **refspec, int refspec_nr,
const struct string_list *push_options,
int dry_run);
extern void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir);