Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
checkout.c: change "unique" member to "num_matches"
author
Ævar Arnfjörð Bjarmason
<avarab@gmail.com>
Tue, 5 Jun 2018 14:40:45 +0000
(14:40 +0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 11 Jun 2018 16:41:01 +0000
(09:41 -0700)
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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
checkout.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (from parent 1:
e417151
)
diff --git
a/checkout.c
b/checkout.c
index 80e430cda876c1a193df5c384d28c2e60303ec3f..7662a39a6203fec511b0034fbe88a2d374f7bbf7 100644
(file)
--- a/
checkout.c
+++ b/
checkout.c
@@
-7,10
+7,10
@@
struct tracking_name_data {
/* const */ char *src_ref;
char *dst_ref;
struct object_id *dst_oid;
/* const */ char *src_ref;
char *dst_ref;
struct object_id *dst_oid;
- int
unique
;
+ int
num_matches
;
};
};
-#define TRACKING_NAME_DATA_INIT { NULL, NULL, NULL,
1
}
+#define TRACKING_NAME_DATA_INIT { NULL, NULL, NULL,
0
}
static int check_tracking_name(struct remote *remote, void *cb_data)
{
static int check_tracking_name(struct remote *remote, void *cb_data)
{
@@
-23,9
+23,9
@@
static int check_tracking_name(struct remote *remote, void *cb_data)
free(query.dst);
return 0;
}
free(query.dst);
return 0;
}
+ cb->num_matches++;
if (cb->dst_ref) {
free(query.dst);
if (cb->dst_ref) {
free(query.dst);
- cb->unique = 0;
return 0;
}
cb->dst_ref = query.dst;
return 0;
}
cb->dst_ref = query.dst;
@@
-39,7
+39,7
@@
const char *unique_tracking_name(const char *name, struct object_id *oid)
cb_data.dst_oid = oid;
for_each_remote(check_tracking_name, &cb_data);
free(cb_data.src_ref);
cb_data.dst_oid = oid;
for_each_remote(check_tracking_name, &cb_data);
free(cb_data.src_ref);
- if (cb_data.
unique
)
+ if (cb_data.
num_matches == 1
)
return cb_data.dst_ref;
free(cb_data.dst_ref);
return NULL;
return cb_data.dst_ref;
free(cb_data.dst_ref);
return NULL;