I tried that first. But then it looks like this

	if (git_reference_is_branch(ref)) {
          /* */
	} else if (git_reference_is_remote(ref)) {
          /* */
	} else {
          /* */
		return -1;
	}

	*out = branch_name;
	return 0;

Are the two return statements in two different levels acceptable for you?