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
This commit is contained in:
13
submodule.c
13
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user