MCPcopy Create free account
hub / github.com/git/git / unique_tracking_name

Function unique_tracking_name

checkout.c:50–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50char *unique_tracking_name(const char *name, struct object_id *oid,
51 int *dwim_remotes_matched)
52{
53 struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;
54 const char *default_remote = NULL;
55 if (!repo_config_get_string_tmp(the_repository, "checkout.defaultremote", &default_remote))
56 cb_data.default_remote = default_remote;
57 cb_data.src_ref = xstrfmt("refs/heads/%s", name);
58 cb_data.dst_oid = oid;
59 for_each_remote(check_tracking_name, &cb_data);
60 if (dwim_remotes_matched)
61 *dwim_remotes_matched = cb_data.num_matches;
62 free(cb_data.src_ref);
63 if (cb_data.num_matches == 1) {
64 free(cb_data.default_dst_ref);
65 free(cb_data.default_dst_oid);
66 return cb_data.dst_ref;
67 }
68 free(cb_data.dst_ref);
69 if (cb_data.default_dst_ref) {
70 oidcpy(oid, cb_data.default_dst_oid);
71 free(cb_data.default_dst_oid);
72 return cb_data.default_dst_ref;
73 }
74 return NULL;
75}

Callers 3

dwim_branchFunction · 0.85
addFunction · 0.85
parse_remote_branchFunction · 0.85

Calls 4

xstrfmtFunction · 0.85
for_each_remoteFunction · 0.85
oidcpyFunction · 0.85

Tested by

no test coverage detected