| 718 | const char *name); |
| 719 | |
| 720 | char *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 | |
| 748 | static void validate_remote_url(struct remote *remote) |
| 749 | { |
no test coverage detected