diff options
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/transport.c b/transport.c index ca7bb441bf..59c9727d8d 100644 --- a/transport.c +++ b/transport.c @@ -192,7 +192,9 @@ static void set_upstreams(struct transport *transport, struct ref *refs, static const char *rsync_url(const char *url) { - return !starts_with(url, "rsync://") ? skip_prefix(url, "rsync:") : url; + if (!starts_with(url, "rsync://")) + skip_prefix(url, "rsync:", &url); + return url; } static struct ref *get_refs_via_rsync(struct transport *transport, int for_push) @@ -1132,8 +1134,7 @@ int transport_push(struct transport *transport, return transport->push(transport, refspec_nr, refspec, flags); } else if (transport->push_refs) { - struct ref *remote_refs = - transport->get_refs_list(transport, 1); + struct ref *remote_refs; struct ref *local_refs = get_local_heads(); int match_flags = MATCH_REFS_NONE; int verbose = (transport->verbose > 0); @@ -1142,6 +1143,11 @@ int transport_push(struct transport *transport, int pretend = flags & TRANSPORT_PUSH_DRY_RUN; int push_ret, ret, err; + if (check_push_refs(local_refs, refspec_nr, refspec) < 0) + return -1; + + remote_refs = transport->get_refs_list(transport, 1); + if (flags & TRANSPORT_PUSH_ALL) match_flags |= MATCH_REFS_ALL; if (flags & TRANSPORT_PUSH_MIRROR) |