if (refspecs.nr) {
char *private;
- private = apply_refspecs(refspecs.items, refspecs.nr, full_name);
+ private = apply_refspecs(&refspecs, full_name);
if (private) {
free(full_name);
full_name = private;
struct remote *remote = remote_get(remote_name);
if (remote && remote->push.nr &&
- (dst = apply_refspecs(remote->push.items,
- remote->push.nr,
+ (dst = apply_refspecs(&remote->push,
branch->refname))) {
if (explicit)
*explicit = 1;
return -1;
}
-char *apply_refspecs(struct refspec_item *refspecs, int nr_refspec,
- const char *name)
+char *apply_refspecs(struct refspec *rs, const char *name)
{
struct refspec_item query;
memset(&query, 0, sizeof(struct refspec_item));
query.src = (char *)name;
- if (query_refspecs(refspecs, nr_refspec, &query))
+ if (query_refspecs(rs->items, rs->nr, &query))
return NULL;
return query.dst;
{
char *ret;
- ret = apply_refspecs(remote->fetch.items, remote->fetch.nr, refname);
+ ret = apply_refspecs(&remote->fetch, refname);
if (!ret)
return error_buf(err,
_("push destination '%s' on remote '%s' has no local tracking branch"),
char *dst;
const char *ret;
- dst = apply_refspecs(remote->push.items, remote->push.nr,
- branch->refname);
+ dst = apply_refspecs(&remote->push, branch->refname);
if (!dst)
return error_buf(err,
_("push refspecs for '%s' do not include '%s'"),
{
char *dst;
- dst = apply_refspecs(remote->fetch.items, remote->fetch.nr, refname);
+ dst = apply_refspecs(&remote->fetch, refname);
if (!dst)
return -1; /* no tracking ref for refname at remote */
if (read_ref(dst, oid))
struct ref *ref_remove_duplicates(struct ref *ref_map);
extern int query_refspecs(struct refspec_item *specs, int nr, struct refspec_item *query);
-char *apply_refspecs(struct refspec_item *refspecs, int nr_refspec,
- const char *name);
+char *apply_refspecs(struct refspec *rs, const char *name);
int check_push_refs(struct ref *src, int nr_refspec, const char **refspec);
int match_push_refs(struct ref *src, struct ref **dst,
continue;
name = posn->symref ? posn->symref : posn->name;
if (data->rs.nr)
- private = apply_refspecs(data->rs.items, data->rs.nr, name);
+ private = apply_refspecs(&data->rs, name);
else
private = xstrdup(name);
if (private) {
continue;
/* propagate back the update to the remote namespace */
- private = apply_refspecs(data->rs.items, data->rs.nr, ref->name);
+ private = apply_refspecs(&data->rs, ref->name);
if (!private)
continue;
update_ref("update by helper", private, &ref->new_oid, NULL,
char *private;
struct object_id oid;
- private = apply_refspecs(data->rs.items, data->rs.nr, ref->name);
+ private = apply_refspecs(&data->rs, ref->name);
if (private && !get_oid(private, &oid)) {
strbuf_addf(&buf, "^%s", private);
string_list_append_nodup(&revlist_args,