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

Function find_tracked_branch

branch.c:35–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33};
34
35static int find_tracked_branch(struct remote *remote, void *priv)
36{
37 struct find_tracked_branch_cb *ftb = priv;
38 struct tracking *tracking = ftb->tracking;
39
40 if (!remote_find_tracking(remote, &tracking->spec)) {
41 switch (++tracking->matches) {
42 case 1:
43 string_list_append_nodup(tracking->srcs, tracking->spec.src);
44 tracking->remote = remote->name;
45 break;
46 case 2:
47 /* there are at least two remotes; backfill the first one */
48 string_list_append(&ftb->ambiguous_remotes, tracking->remote);
49 /* fall through */
50 default:
51 string_list_append(&ftb->ambiguous_remotes, remote->name);
52 free(tracking->spec.src);
53 string_list_clear(tracking->srcs, 0);
54 break;
55 }
56 /* remote_find_tracking() searches by src if present */
57 tracking->spec.src = NULL;
58 }
59 return 0;
60}
61
62static int should_setup_rebase(const char *origin)
63{

Callers

nothing calls this directly

Calls 4

remote_find_trackingFunction · 0.85
string_list_append_nodupFunction · 0.85
string_list_clearFunction · 0.85
string_list_appendFunction · 0.70

Tested by

no test coverage detected