Method: Rugged::Branch#remote_name
- Defined in:
- ext/rugged/rugged_branch.c
#remote_name ⇒ String
Get the name of the remote the branch belongs to.
If branch is a remote branch, the name of the remote it belongs to is returned. If branch is a tracking branch, the name of the remote of the tracked branch is returned.
Otherwise, nil is returned.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'ext/rugged/rugged_branch.c', line 84 static VALUE rb_git_branch_remote_name(VALUE self) { git_reference *branch, *remote_ref; int error = 0; Data_Get_Struct(self, git_reference, branch); if (git_reference_is_remote(branch)) { remote_ref = branch; } else { error = git_branch_upstream(&remote_ref, branch); if (error == GIT_ENOTFOUND) return Qnil; rugged_exception_check(error); } return rb_git_branch__remote_name( rugged_owner(self), git_reference_name(remote_ref)); } |