diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-12-16 15:27:48 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-16 15:27:48 -0800 |
commit | 12cf1135df64ae2a94e6146f96fdb963d2ee152e (patch) | |
tree | 740e28ea6e2d953c5cdc5b709cfeafad3f0c3543 /submodule.c | |
parent | af952dac7a6997e587ded97e4051a927e5384423 (diff) | |
parent | 0301c821c5cd124733accfbff0ddbf7f0b0ee9fb (diff) | |
download | git-12cf1135df64ae2a94e6146f96fdb963d2ee152e.tar.gz |
Merge branch 'bw/push-dry-run'
"git push --dry-run --recurse-submodule=on-demand" wasn't
"--dry-run" in the submodules.
* bw/push-dry-run:
push: fix --dry-run to not push submodules
push: --dry-run updates submodules when --recurse-submodules=on-demand
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/submodule.c b/submodule.c index 00dd655a53..ece17315d6 100644 --- a/submodule.c +++ b/submodule.c @@ -661,16 +661,17 @@ int find_unpushed_submodules(struct sha1_array *commits, return needs_pushing->nr; } -static int push_submodule(const char *path) +static int push_submodule(const char *path, int dry_run) { if (add_submodule_odb(path)) return 1; if (for_each_remote_ref_submodule(path, has_remote, NULL) > 0) { struct child_process cp = CHILD_PROCESS_INIT; - const char *argv[] = {"push", NULL}; + argv_array_push(&cp.args, "push"); + if (dry_run) + argv_array_push(&cp.args, "--dry-run"); - cp.argv = argv; prepare_submodule_repo_env(&cp.env_array); cp.git_cmd = 1; cp.no_stdin = 1; @@ -683,7 +684,9 @@ static int push_submodule(const char *path) return 1; } -int push_unpushed_submodules(struct sha1_array *commits, const char *remotes_name) +int push_unpushed_submodules(struct sha1_array *commits, + const char *remotes_name, + int dry_run) { int i, ret = 1; struct string_list needs_pushing = STRING_LIST_INIT_DUP; @@ -694,7 +697,7 @@ int push_unpushed_submodules(struct sha1_array *commits, const char *remotes_nam 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)) { + if (!push_submodule(path, dry_run)) { fprintf(stderr, "Unable to push submodule '%s'\n", path); ret = 0; } |