diff options
author | Heiko Voigt <hvoigt@hvoigt.net> | 2012-03-29 09:21:24 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-03-30 09:02:55 -0700 |
commit | eb21c732d6b642a8f33abd69071a95de01d5061b (patch) | |
tree | 69fd9caa7118ace0b1453830aa2ef86e006caef8 /transport.c | |
parent | a762e51ef2a39b0c326a1529dbe7f4cb303960db (diff) | |
download | git-eb21c732d6b642a8f33abd69071a95de01d5061b.tar.gz |
push: teach --recurse-submodules the on-demand option
When using this option git will search for all submodules that
have changed in the revisions to be send. It will then try to
push the currently checked out branch of each submodule.
This helps when a user has finished working on a change which
involves submodules and just wants to push everything in one go.
Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/transport.c b/transport.c index abde8f60d3..4177b7d609 100644 --- a/transport.c +++ b/transport.c @@ -1009,6 +1009,11 @@ static void die_with_unpushed_submodules(struct string_list *needs_pushing) "not be found on any remote:\n"); for (i = 0; i < needs_pushing->nr; i++) printf(" %s\n", needs_pushing->items[i].string); + fprintf(stderr, "\nPlease try\n\n" + " git push --recurse-submodules=on-demand\n\n" + "or cd to the path and use\n\n" + " git push\n\n" + "to push them to a remote.\n\n"); string_list_clear(needs_pushing, 0); @@ -1053,7 +1058,17 @@ int transport_push(struct transport *transport, flags & TRANSPORT_PUSH_MIRROR, flags & TRANSPORT_PUSH_FORCE); - if ((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) && !is_bare_repository()) { + if ((flags & TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND) && !is_bare_repository()) { + struct ref *ref = remote_refs; + for (; ref; ref = ref->next) + if (!is_null_sha1(ref->new_sha1) && + !push_unpushed_submodules(ref->new_sha1, + transport->remote->name)) + die ("Failed to push all needed submodules!"); + } + + if ((flags & (TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND | + TRANSPORT_RECURSE_SUBMODULES_CHECK)) && !is_bare_repository()) { struct ref *ref = remote_refs; struct string_list needs_pushing; |