X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=transport.c;h=a02f79aae3d91ea4109d21a9ed9ca2d962125375;hb=a111eb7808bfdb90286e54b9ccdaea4f3bec3102;hp=4dba6f8815a80093a8ac9edc226d99bba1bb6394;hpb=7a876edf5d5224e0755cfabb808b042f300e293d;p=git.git diff --git a/transport.c b/transport.c index 4dba6f881..a02f79aae 100644 --- a/transport.c +++ b/transport.c @@ -192,7 +192,7 @@ static const char *rsync_url(const char *url) static struct ref *get_refs_via_rsync(struct transport *transport, int for_push) { struct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT; - struct ref dummy = {0}, *tail = &dummy; + struct ref dummy = {NULL}, *tail = &dummy; struct child_process rsync; const char *args[5]; int temp_dir_len; @@ -789,6 +789,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re args.use_thin_pack = data->options.thin; args.verbose = (transport->verbose > 0); args.quiet = (transport->verbose < 0); + args.progress = transport->progress; args.dry_run = !!(flags & TRANSPORT_PUSH_DRY_RUN); args.porcelain = !!(flags & TRANSPORT_PUSH_PORCELAIN); @@ -1188,3 +1189,37 @@ char *transport_anonymize_url(const char *url) literal_copy: return xstrdup(url); } + +int refs_from_alternate_cb(struct alternate_object_database *e, void *cb) +{ + char *other; + size_t len; + struct remote *remote; + struct transport *transport; + const struct ref *extra; + alternate_ref_fn *ref_fn = cb; + + e->name[-1] = '\0'; + other = xstrdup(real_path(e->base)); + e->name[-1] = '/'; + len = strlen(other); + + while (other[len-1] == '/') + other[--len] = '\0'; + if (len < 8 || memcmp(other + len - 8, "/objects", 8)) + return 0; + /* Is this a git repository with refs? */ + memcpy(other + len - 8, "/refs", 6); + if (!is_directory(other)) + return 0; + other[len - 8] = '\0'; + remote = remote_get(other); + transport = transport_get(remote, other); + for (extra = transport_get_remote_refs(transport); + extra; + extra = extra->next) + ref_fn(extra, NULL); + transport_disconnect(transport); + free(other); + return 0; +}