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

Function check_tracking_name

checkout.c:24–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22#define TRACKING_NAME_DATA_INIT { 0 }
23
24static int check_tracking_name(struct remote *remote, void *cb_data)
25{
26 struct tracking_name_data *cb = cb_data;
27 struct refspec_item query;
28 memset(&query, 0, sizeof(struct refspec_item));
29 query.src = cb->src_ref;
30 if (remote_find_tracking(remote, &query) ||
31 repo_get_oid(the_repository, query.dst, cb->dst_oid)) {
32 free(query.dst);
33 return 0;
34 }
35 cb->num_matches++;
36 if (cb->default_remote && !strcmp(remote->name, cb->default_remote)) {
37 struct object_id *dst = xmalloc(sizeof(*cb->default_dst_oid));
38 cb->default_dst_ref = xstrdup(query.dst);
39 oidcpy(dst, cb->dst_oid);
40 cb->default_dst_oid = dst;
41 }
42 if (cb->dst_ref) {
43 free(query.dst);
44 return 0;
45 }
46 cb->dst_ref = query.dst;
47 return 0;
48}
49
50char *unique_tracking_name(const char *name, struct object_id *oid,
51 int *dwim_remotes_matched)

Callers

nothing calls this directly

Calls 5

remote_find_trackingFunction · 0.85
repo_get_oidFunction · 0.85
xstrdupFunction · 0.85
oidcpyFunction · 0.85
xmallocFunction · 0.70

Tested by

no test coverage detected