Method: Rugged::Reference#target_id
- Defined in:
- ext/rugged/rugged_reference.c
#target_id ⇒ Object #target_id ⇒ Object
Return the target identifier of reference.
If reference is a symbolic reference, it returns the canonical name of the target reference.
If reference is a direct reference, it returns the sha id of the target.
ref1.type #=> :symbolic
ref1.target_id #=> "refs/heads/master"
ref2.type #=> :direct
ref2.target_id #=> "de5ba987198bcf2518885f0fc1350e5172cded78"
155 156 157 158 159 160 161 162 163 164 165 |
# File 'ext/rugged/rugged_reference.c', line 155
static VALUE rb_git_ref_target_id(VALUE self)
{
git_reference *ref;
Data_Get_Struct(self, git_reference, ref);
if (git_reference_type(ref) == GIT_REF_OID) {
return rugged_create_oid(git_reference_target(ref));
} else {
return rb_str_new_utf8(git_reference_symbolic_target(ref));
}
}
|