Method: Rugged.valid_full_oid?

Defined in:
ext/rugged/rugged.c

.valid_full_oid?(oid) ⇒ Boolean

Checks to see if a string contains a full 40-character sha1.

Rugged.valid_full_oid?('d8786bfc97485e8d7b19b21fb88c8ef1f199fc3f')
#=> true

Returns:

  • (Boolean)


129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'ext/rugged/rugged.c', line 129

static VALUE rb_git_valid_full_oid(VALUE self, VALUE hex)
{
  git_oid oid;
  int errorcode;

  Check_Type(hex, T_STRING);
  errorcode = git_oid_fromstr(&oid, StringValueCStr(hex));
  if (errorcode < 0) {
    return Qfalse;
  } else {
    return Qtrue;
  }
}