diff options
author | Brandon Williams <bmwill@google.com> | 2017-04-05 10:47:16 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-11 00:45:03 -0700 |
commit | 2a90556dde47f27e12a3f8adb1397fd05e5b6690 (patch) | |
tree | 97654f97664b31bd664cc8d7343da2f32f6005fd /submodule.c | |
parent | 54cc8aca60e474e637e9d71b57ee2c6f1fb197e6 (diff) | |
download | git-2a90556dde47f27e12a3f8adb1397fd05e5b6690.tar.gz |
push: propagate push-options with --recurse-submodules
Teach push --recurse-submodules to propagate push-options recursively to
the pushes performed in the submodules.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/submodule.c b/submodule.c index c52d6634c5..de444be61a 100644 --- a/submodule.c +++ b/submodule.c @@ -782,7 +782,9 @@ int find_unpushed_submodules(struct sha1_array *commits, return needs_pushing->nr; } -static int push_submodule(const char *path, int dry_run) +static int push_submodule(const char *path, + const struct string_list *push_options, + int dry_run) { if (add_submodule_odb(path)) return 1; @@ -793,6 +795,12 @@ static int push_submodule(const char *path, int dry_run) if (dry_run) argv_array_push(&cp.args, "--dry-run"); + if (push_options && push_options->nr) { + const struct string_list_item *item; + for_each_string_list_item(item, push_options) + argv_array_pushf(&cp.args, "--push-option=%s", + item->string); + } prepare_submodule_repo_env(&cp.env_array); cp.git_cmd = 1; cp.no_stdin = 1; @@ -807,6 +815,7 @@ static int push_submodule(const char *path, int dry_run) int push_unpushed_submodules(struct sha1_array *commits, const char *remotes_name, + const struct string_list *push_options, int dry_run) { int i, ret = 1; @@ -818,7 +827,7 @@ int push_unpushed_submodules(struct sha1_array *commits, for (i = 0; i < needs_pushing.nr; i++) { const char *path = needs_pushing.items[i].string; fprintf(stderr, "Pushing submodule '%s'\n", path); - if (!push_submodule(path, dry_run)) { + if (!push_submodule(path, push_options, dry_run)) { fprintf(stderr, "Unable to push submodule '%s'\n", path); ret = 0; } |