Skip to content

Commit e4d2d55

Browse files
avargitster
authored andcommitted
checkout.c: change "unique" member to "num_matches"
Internally track how many matches we find in the check_tracking_name() callback. Nothing uses this now, but it will be made use of in a later change. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e417151 commit e4d2d55

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

checkout.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ struct tracking_name_data {
77
/* const */ char *src_ref;
88
char *dst_ref;
99
struct object_id *dst_oid;
10-
int unique;
10+
int num_matches;
1111
};
1212

13-
#define TRACKING_NAME_DATA_INIT { NULL, NULL, NULL, 1 }
13+
#define TRACKING_NAME_DATA_INIT { NULL, NULL, NULL, 0 }
1414

1515
static int check_tracking_name(struct remote *remote, void *cb_data)
1616
{
@@ -23,9 +23,9 @@ static int check_tracking_name(struct remote *remote, void *cb_data)
2323
free(query.dst);
2424
return 0;
2525
}
26+
cb->num_matches++;
2627
if (cb->dst_ref) {
2728
free(query.dst);
28-
cb->unique = 0;
2929
return 0;
3030
}
3131
cb->dst_ref = query.dst;
@@ -39,7 +39,7 @@ const char *unique_tracking_name(const char *name, struct object_id *oid)
3939
cb_data.dst_oid = oid;
4040
for_each_remote(check_tracking_name, &cb_data);
4141
free(cb_data.src_ref);
42-
if (cb_data.unique)
42+
if (cb_data.num_matches == 1)
4343
return cb_data.dst_ref;
4444
free(cb_data.dst_ref);
4545
return NULL;

0 commit comments

Comments
 (0)