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

Function remote_ref_for_branch

remote.c:720–746  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

718 const char *name);
719
720char *remote_ref_for_branch(struct branch *branch, int for_push)
721{
722 read_config(the_repository, 0);
723 die_on_missing_branch(the_repository, branch);
724
725 if (branch) {
726 if (!for_push) {
727 if (branch->merge_nr) {
728 return xstrdup(branch->merge[0]->src);
729 }
730 } else {
731 char *dst;
732 const char *remote_name = remotes_pushremote_for_branch(
733 the_repository->remote_state, branch,
734 NULL);
735 struct remote *remote = remotes_remote_get(
736 the_repository, remote_name);
737
738 if (remote && remote->push.nr &&
739 (dst = apply_refspecs(&remote->push,
740 branch->refname))) {
741 return dst;
742 }
743 }
744 }
745 return NULL;
746}
747
748static void validate_remote_url(struct remote *remote)
749{

Callers 1

fill_remote_ref_detailsFunction · 0.85

Calls 6

read_configFunction · 0.85
die_on_missing_branchFunction · 0.85
xstrdupFunction · 0.85
remotes_remote_getFunction · 0.85
apply_refspecsFunction · 0.85

Tested by

no test coverage detected