Skip to content

Commit 0ad4a5f

Browse files
bmwillgitster
authored andcommitted
refspec: rename struct refspec to struct refspec_item
In preparation for introducing an abstraction around a collection of refspecs (much like how a 'struct pathspec' is a collection of 'struct pathspec_item's) rename the existing 'struct refspec' to 'struct refspec_item'. Signed-off-by: Brandon Williams <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ec0cb49 commit 0ad4a5f

15 files changed

+73
-73
lines changed

branch.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "worktree.h"
1010

1111
struct tracking {
12-
struct refspec spec;
12+
struct refspec_item spec;
1313
char *src;
1414
const char *remote;
1515
int matches;
@@ -219,8 +219,8 @@ int validate_new_branchname(const char *name, struct strbuf *ref, int force)
219219
static int check_tracking_branch(struct remote *remote, void *cb_data)
220220
{
221221
char *tracking_branch = cb_data;
222-
struct refspec query;
223-
memset(&query, 0, sizeof(struct refspec));
222+
struct refspec_item query;
223+
memset(&query, 0, sizeof(struct refspec_item));
224224
query.dst = tracking_branch;
225225
return !remote_find_tracking(remote, &query);
226226
}

builtin/clone.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ static struct ref *find_remote_branch(const struct ref *refs, const char *branch
547547
}
548548

549549
static struct ref *wanted_peer_refs(const struct ref *refs,
550-
struct refspec *refspec)
550+
struct refspec_item *refspec)
551551
{
552552
struct ref *head = copy_ref(find_ref_by_name(refs, "HEAD"));
553553
struct ref *local_refs = head;
@@ -895,7 +895,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
895895
int err = 0, complete_refs_before_fetch = 1;
896896
int submodule_progress;
897897

898-
struct refspec *refspec;
898+
struct refspec_item *refspec;
899899
const char *fetch_pattern;
900900

901901
fetch_if_missing = 0;

builtin/fast-export.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static int use_done_feature;
3636
static int no_data;
3737
static int full_tree;
3838
static struct string_list extra_refs = STRING_LIST_INIT_NODUP;
39-
static struct refspec *refspecs;
39+
static struct refspec_item *refspecs;
4040
static int refspecs_nr;
4141
static int anonymize;
4242

@@ -979,7 +979,7 @@ static void handle_deletes(void)
979979
{
980980
int i;
981981
for (i = 0; i < refspecs_nr; i++) {
982-
struct refspec *refspec = &refspecs[i];
982+
struct refspec_item *refspec = &refspecs[i];
983983
if (*refspec->src)
984984
continue;
985985

builtin/fetch.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static void add_merge_config(struct ref **head,
203203

204204
for (i = 0; i < branch->merge_nr; i++) {
205205
struct ref *rm, **old_tail = *tail;
206-
struct refspec refspec;
206+
struct refspec_item refspec;
207207

208208
for (rm = *head; rm; rm = rm->next) {
209209
if (branch_merge_matches(branch, i, rm->name)) {
@@ -340,7 +340,7 @@ static void find_non_local_tags(struct transport *transport,
340340
}
341341

342342
static struct ref *get_ref_map(struct transport *transport,
343-
struct refspec *refspecs, int refspec_count,
343+
struct refspec_item *refspecs, int refspec_count,
344344
int tags, int *autotags)
345345
{
346346
int i;
@@ -371,7 +371,7 @@ static struct ref *get_ref_map(struct transport *transport,
371371
argv_array_clear(&ref_prefixes);
372372

373373
if (refspec_count) {
374-
struct refspec *fetch_refspec;
374+
struct refspec_item *fetch_refspec;
375375
int fetch_refspec_nr;
376376

377377
for (i = 0; i < refspec_count; i++) {
@@ -965,7 +965,7 @@ static int fetch_refs(struct transport *transport, struct ref *ref_map)
965965
return ret;
966966
}
967967

968-
static int prune_refs(struct refspec *refs, int ref_count, struct ref *ref_map,
968+
static int prune_refs(struct refspec_item *refs, int ref_count, struct ref *ref_map,
969969
const char *raw_url)
970970
{
971971
int url_len, i, result = 0;
@@ -1115,7 +1115,7 @@ static void backfill_tags(struct transport *transport, struct ref *ref_map)
11151115
}
11161116

11171117
static int do_fetch(struct transport *transport,
1118-
struct refspec *refs, int ref_count)
1118+
struct refspec_item *refs, int ref_count)
11191119
{
11201120
struct string_list existing_refs = STRING_LIST_INIT_DUP;
11211121
struct ref *ref_map;
@@ -1357,7 +1357,7 @@ static inline void fetch_one_setup_partial(struct remote *remote)
13571357
static int fetch_one(struct remote *remote, int argc, const char **argv, int prune_tags_ok)
13581358
{
13591359
static const char **refs = NULL;
1360-
struct refspec *refspec;
1360+
struct refspec_item *refspec;
13611361
int ref_nr = 0;
13621362
int j = 0;
13631363
int exit_code;

builtin/pull.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ static const char *get_upstream_branch(const char *remote)
676676
*/
677677
static const char *get_tracking_branch(const char *remote, const char *refspec)
678678
{
679-
struct refspec *spec;
679+
struct refspec_item *spec;
680680
const char *spec_src;
681681
const char *merge_branch;
682682

builtin/push.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ static const char *map_refspec(const char *ref,
8080
return ref;
8181

8282
if (remote->push) {
83-
struct refspec query;
84-
memset(&query, 0, sizeof(struct refspec));
83+
struct refspec_item query;
84+
memset(&query, 0, sizeof(struct refspec_item));
8585
query.src = matched->name;
8686
if (!query_refspecs(remote->push, remote->push_refspec_nr, &query) &&
8787
query.dst) {

builtin/remote.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)
442442
info->dest = xstrdup(item->string);
443443
}
444444
for (i = 0; i < remote->push_refspec_nr; i++) {
445-
struct refspec *spec = remote->push + i;
445+
struct refspec_item *spec = remote->push + i;
446446
if (spec->matching)
447447
item = string_list_append(&states->push, _("(matching)"));
448448
else if (strlen(spec->src))
@@ -462,7 +462,7 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat
462462
{
463463
struct ref *ref, *matches;
464464
struct ref *fetch_map = NULL, **fetch_map_tail = &fetch_map;
465-
struct refspec refspec;
465+
struct refspec_item refspec;
466466

467467
refspec.force = 0;
468468
refspec.pattern = 1;
@@ -515,7 +515,7 @@ static int add_branch_for_removal(const char *refname,
515515
const struct object_id *oid, int flags, void *cb_data)
516516
{
517517
struct branches_for_remote *branches = cb_data;
518-
struct refspec refspec;
518+
struct refspec_item refspec;
519519
struct known_remote *kr;
520520

521521
memset(&refspec, 0, sizeof(refspec));
@@ -834,7 +834,7 @@ static int append_ref_to_tracked_list(const char *refname,
834834
const struct object_id *oid, int flags, void *cb_data)
835835
{
836836
struct ref_states *states = cb_data;
837-
struct refspec refspec;
837+
struct refspec_item refspec;
838838

839839
if (flags & REF_ISSYMREF)
840840
return 0;

builtin/submodule--helper.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1746,11 +1746,11 @@ static int push_check(int argc, const char **argv, const char *prefix)
17461746
if (argc > 2) {
17471747
int i, refspec_nr = argc - 2;
17481748
struct ref *local_refs = get_local_heads();
1749-
struct refspec *refspec = parse_push_refspec(refspec_nr,
1749+
struct refspec_item *refspec = parse_push_refspec(refspec_nr,
17501750
argv + 2);
17511751

17521752
for (i = 0; i < refspec_nr; i++) {
1753-
struct refspec *rs = refspec + i;
1753+
struct refspec_item *rs = refspec + i;
17541754

17551755
if (rs->pattern || rs->matching)
17561756
continue;

checkout.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ struct tracking_name_data {
1313
static int check_tracking_name(struct remote *remote, void *cb_data)
1414
{
1515
struct tracking_name_data *cb = cb_data;
16-
struct refspec query;
17-
memset(&query, 0, sizeof(struct refspec));
16+
struct refspec_item query;
17+
memset(&query, 0, sizeof(struct refspec_item));
1818
query.src = cb->src_ref;
1919
if (remote_find_tracking(remote, &query) ||
2020
get_oid(query.dst, cb->dst_oid)) {

refspec.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "refs.h"
33
#include "refspec.h"
44

5-
static struct refspec s_tag_refspec = {
5+
static struct refspec_item s_tag_refspec = {
66
0,
77
1,
88
0,
@@ -12,12 +12,12 @@ static struct refspec s_tag_refspec = {
1212
};
1313

1414
/* See TAG_REFSPEC for the string version */
15-
const struct refspec *tag_refspec = &s_tag_refspec;
15+
const struct refspec_item *tag_refspec = &s_tag_refspec;
1616

17-
static struct refspec *parse_refspec_internal(int nr_refspec, const char **refspec, int fetch, int verify)
17+
static struct refspec_item *parse_refspec_internal(int nr_refspec, const char **refspec, int fetch, int verify)
1818
{
1919
int i;
20-
struct refspec *rs = xcalloc(nr_refspec, sizeof(*rs));
20+
struct refspec_item *rs = xcalloc(nr_refspec, sizeof(*rs));
2121

2222
for (i = 0; i < nr_refspec; i++) {
2323
size_t llen;
@@ -135,24 +135,24 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp
135135

136136
int valid_fetch_refspec(const char *fetch_refspec_str)
137137
{
138-
struct refspec *refspec;
138+
struct refspec_item *refspec;
139139

140140
refspec = parse_refspec_internal(1, &fetch_refspec_str, 1, 1);
141141
free_refspec(1, refspec);
142142
return !!refspec;
143143
}
144144

145-
struct refspec *parse_fetch_refspec(int nr_refspec, const char **refspec)
145+
struct refspec_item *parse_fetch_refspec(int nr_refspec, const char **refspec)
146146
{
147147
return parse_refspec_internal(nr_refspec, refspec, 1, 0);
148148
}
149149

150-
struct refspec *parse_push_refspec(int nr_refspec, const char **refspec)
150+
struct refspec_item *parse_push_refspec(int nr_refspec, const char **refspec)
151151
{
152152
return parse_refspec_internal(nr_refspec, refspec, 0, 0);
153153
}
154154

155-
void free_refspec(int nr_refspec, struct refspec *refspec)
155+
void free_refspec(int nr_refspec, struct refspec_item *refspec)
156156
{
157157
int i;
158158

refspec.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#define REFSPEC_H
33

44
#define TAG_REFSPEC "refs/tags/*:refs/tags/*"
5-
extern const struct refspec *tag_refspec;
5+
extern const struct refspec_item *tag_refspec;
66
7-
struct refspec {
7+
struct refspec_item {
88
unsigned force : 1;
99
unsigned pattern : 1;
1010
unsigned matching : 1;
@@ -15,9 +15,9 @@ struct refspec {
1515
};
1616
1717
int valid_fetch_refspec(const char *refspec);
18-
struct refspec *parse_fetch_refspec(int nr_refspec, const char **refspec);
19-
struct refspec *parse_push_refspec(int nr_refspec, const char **refspec);
18+
struct refspec_item *parse_fetch_refspec(int nr_refspec, const char **refspec);
19+
struct refspec_item *parse_push_refspec(int nr_refspec, const char **refspec);
2020
21-
void free_refspec(int nr_refspec, struct refspec *refspec);
21+
void free_refspec(int nr_refspec, struct refspec_item *refspec);
2222
2323
#endif /* REFSPEC_H */

0 commit comments

Comments
 (0)