summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2016-11-17 18:46:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-11-23 16:39:14 (GMT)
commit0301c821c5cd124733accfbff0ddbf7f0b0ee9fb (patch)
treeb41edb26a5a5e4b91b24124bec9c0df067e2be19 /transport.c
parent1aa73658405ad423127b3c14ac13e46f9ad0163a (diff)
downloadgit-0301c821c5cd124733accfbff0ddbf7f0b0ee9fb.zip
git-0301c821c5cd124733accfbff0ddbf7f0b0ee9fb.tar.gz
git-0301c821c5cd124733accfbff0ddbf7f0b0ee9fb.tar.bz2
push: fix --dry-run to not push submodules
Teach push to respect the --dry-run option when configured to recursively push submodules 'on-demand'. This is done by passing the --dry-run flag to the child process which performs a push for a submodules when performing a dry-run. In order to preserve good user experience, the additional check for unpushed submodules is skipped during a dry-run when --recurse-submodules=on-demand. The check is skipped because the submodule pushes were performed as dry-runs and this check would always fail as the submodules would still need to be pushed. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/transport.c b/transport.c
index c3fdd5d..e0651a5 100644
--- a/transport.c
+++ b/transport.c
@@ -921,15 +921,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;