summaryrefslogtreecommitdiff
path: root/checkout.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2018-06-05 14:40:46 +0000
committerJunio C Hamano <gitster@pobox.com>2018-06-11 09:41:01 -0700
commit3c87aa946a9ffc31cf1355b11e63df7c3315a2f9 (patch)
tree30880fd6d627b4e9dc6a7640146e5a9620bf8b01 /checkout.c
parente4d2d55ae46216872c9eaa3b9d0072aa8361d5d3 (diff)
downloadgit-3c87aa946a9ffc31cf1355b11e63df7c3315a2f9.tar.gz
checkout: pass the "num_matches" up to callers
Pass the previously added "num_matches" struct value up to the callers of unique_tracking_name(). This will allow callers to optionally print better error messages in a later change. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'checkout.c')
-rw-r--r--checkout.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/checkout.c b/checkout.c
index 7662a39a62..ee3a7e9c05 100644
--- a/checkout.c
+++ b/checkout.c
@@ -32,12 +32,15 @@ static int check_tracking_name(struct remote *remote, void *cb_data)
return 0;
}
-const char *unique_tracking_name(const char *name, struct object_id *oid)
+const char *unique_tracking_name(const char *name, struct object_id *oid,
+ int *dwim_remotes_matched)
{
struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;
cb_data.src_ref = xstrfmt("refs/heads/%s", name);
cb_data.dst_oid = oid;
for_each_remote(check_tracking_name, &cb_data);
+ if (dwim_remotes_matched)
+ *dwim_remotes_matched = cb_data.num_matches;
free(cb_data.src_ref);
if (cb_data.num_matches == 1)
return cb_data.dst_ref;