summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-04-05 17:47:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-11 07:45:03 (GMT)
commit2a90556dde47f27e12a3f8adb1397fd05e5b6690 (patch)
tree97654f97664b31bd664cc8d7343da2f32f6005fd /submodule.c
parent54cc8aca60e474e637e9d71b57ee2c6f1fb197e6 (diff)
downloadgit-2a90556dde47f27e12a3f8adb1397fd05e5b6690.zip
git-2a90556dde47f27e12a3f8adb1397fd05e5b6690.tar.gz
git-2a90556dde47f27e12a3f8adb1397fd05e5b6690.tar.bz2
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.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/submodule.c b/submodule.c
index c52d663..de444be 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;
}