Method: Rugged::Branch#upstream

Defined in:
ext/rugged/rugged_branch.c

#upstreamObject

Returns the remote tracking branch, or nil if the branch is remote or has no tracking branch.


114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'ext/rugged/rugged_branch.c', line 114

static VALUE rb_git_branch_upstream(VALUE self)
{
	git_reference *branch, *upstream_branch;
	int error;

	Data_Get_Struct(self, git_reference, branch);

	if (git_reference_is_remote(branch))
		return Qnil;

	error = git_branch_upstream(&upstream_branch, branch);

	if (error == GIT_ENOTFOUND)
		return Qnil;

	rugged_exception_check(error);

	return rugged_branch_new(rugged_owner(self), upstream_branch);
}