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

Function set_merge

remote.c:1757–1791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1755}
1756
1757static void set_merge(struct repository *repo, struct branch *ret)
1758{
1759 struct remote *remote;
1760 char *ref;
1761 struct object_id oid;
1762 int i;
1763
1764 if (!ret)
1765 return; /* no branch */
1766 if (ret->set_merge)
1767 return; /* already run */
1768 if (!ret->remote_name || !ret->merge_nr) {
1769 /*
1770 * no merge config; let's make sure we don't confuse callers
1771 * with a non-zero merge_nr but a NULL merge
1772 */
1773 merge_clear(ret);
1774 return;
1775 }
1776 ret->set_merge = 1;
1777
1778 remote = remotes_remote_get(repo, ret->remote_name);
1779
1780 for (i = 0; i < ret->merge_nr; i++) {
1781 if (!remote_find_tracking(remote, ret->merge[i]) ||
1782 strcmp(ret->remote_name, "."))
1783 continue;
1784 if (repo_dwim_ref(repo, ret->merge[i]->src,
1785 strlen(ret->merge[i]->src), &oid, &ref,
1786 0) == 1)
1787 ret->merge[i]->dst = ref;
1788 else
1789 ret->merge[i]->dst = xstrdup(ret->merge[i]->src);
1790 }
1791}
1792
1793static struct branch *repo_branch_get(struct repository *repo, const char *name)
1794{

Callers 1

repo_branch_getFunction · 0.85

Calls 5

merge_clearFunction · 0.85
remotes_remote_getFunction · 0.85
remote_find_trackingFunction · 0.85
repo_dwim_refFunction · 0.85
xstrdupFunction · 0.85

Tested by

no test coverage detected