From: Junio C Hamano Date: Sun, 16 Oct 2011 03:46:39 +0000 (-0700) Subject: Merge branch 'jc/maint-bundle-too-quiet' into maint X-Git-Tag: v1.7.7.1~15 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6323a14701a191546f95fb4ab8266abcfc97d32d;hp=-c;p=git.git Merge branch 'jc/maint-bundle-too-quiet' into maint * jc/maint-bundle-too-quiet: Teach progress eye-candy to fetch_refs_from_bundle() --- 6323a14701a191546f95fb4ab8266abcfc97d32d diff --combined transport.c index fa279d531,ca0150066..e1940615e --- a/transport.c +++ b/transport.c @@@ -10,7 -10,6 +10,7 @@@ #include "refs.h" #include "branch.h" #include "url.h" +#include "submodule.h" /* rsync support */ @@@ -157,7 -156,7 +157,7 @@@ static void set_upstreams(struct transp continue; if (!ref->peer_ref) continue; - if (!ref->new_sha1 || is_null_sha1(ref->new_sha1)) + if (is_null_sha1(ref->new_sha1)) continue; /* Follow symbolic refs (mainly for HEAD). */ @@@ -432,7 -431,8 +432,8 @@@ static int fetch_refs_from_bundle(struc int nr_heads, struct ref **to_fetch) { struct bundle_transport_data *data = transport->data; - return unbundle(&data->header, data->fd); + return unbundle(&data->header, data->fd, + transport->progress ? BUNDLE_VERBOSE : 0); } static int close_bundle(struct transport *transport) @@@ -1042,14 -1042,6 +1043,14 @@@ int transport_push(struct transport *tr flags & TRANSPORT_PUSH_MIRROR, flags & TRANSPORT_PUSH_FORCE); + if ((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) && !is_bare_repository()) { + struct ref *ref = remote_refs; + for (; ref; ref = ref->next) + if (!is_null_sha1(ref->new_sha1) && + check_submodule_needs_pushing(ref->new_sha1,transport->remote->name)) + die("There are unpushed submodules, aborting."); + } + push_ret = transport->push_refs(transport, remote_refs, flags); err = push_had_errors(remote_refs); ret = push_ret | err; @@@ -1199,20 -1191,14 +1200,20 @@@ literal_copy return xstrdup(url); } -int refs_from_alternate_cb(struct alternate_object_database *e, void *cb) +struct alternate_refs_data { + alternate_ref_fn *fn; + void *data; +}; + +static int refs_from_alternate_cb(struct alternate_object_database *e, + void *data) { char *other; size_t len; struct remote *remote; struct transport *transport; const struct ref *extra; - alternate_ref_fn *ref_fn = cb; + struct alternate_refs_data *cb = data; e->name[-1] = '\0'; other = xstrdup(real_path(e->base)); @@@ -1233,16 -1219,8 +1234,16 @@@ for (extra = transport_get_remote_refs(transport); extra; extra = extra->next) - ref_fn(extra, NULL); + cb->fn(extra, cb->data); transport_disconnect(transport); free(other); return 0; } + +void for_each_alternate_ref(alternate_ref_fn fn, void *data) +{ + struct alternate_refs_data cb; + cb.fn = fn; + cb.data = data; + foreach_alt_odb(refs_from_alternate_cb, &cb); +}