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:
Junio C Hamano
2016-12-16 15:27:48 -08:00
4 changed files with 41 additions and 9 deletions

View File

@ -955,15 +955,18 @@ int transport_push(struct transport *transport,
if (!is_null_oid(&ref->new_oid))
sha1_array_append(&commits, ref->new_oid.hash);
if (!push_unpushed_submodules(&commits, transport->remote->name)) {
if (!push_unpushed_submodules(&commits,
transport->remote->name,
pretend)) {
sha1_array_clear(&commits);
die("Failed to push all needed submodules!");
}
sha1_array_clear(&commits);
}
if ((flags & (TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND |
TRANSPORT_RECURSE_SUBMODULES_CHECK)) && !is_bare_repository()) {
if (((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) ||
((flags & TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND) &&
!pretend)) && !is_bare_repository()) {
struct ref *ref = remote_refs;
struct string_list needs_pushing = STRING_LIST_INIT_DUP;
struct sha1_array commits = SHA1_ARRAY_INIT;