Method: Rugged::Repository.hash_data
- Defined in:
- ext/rugged/rugged_repo.c
.hash_data(str, type) ⇒ Object
Hash the contents of str
as raw bytes (ignoring any encoding information) and adding the relevant header corresponding to type
, and return a hex string representing the result from the hash.
Repository.hash_data('hello world', :commit) #=> "de5ba987198bcf2518885f0fc1350e5172cded78"
Repository.hash_data('hello_world', :tag) #=> "9d09060c850defbc7711d08b57def0d14e742f4e"
1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 |
# File 'ext/rugged/rugged_repo.c', line 1332
static VALUE rb_git_repo_hash(VALUE self, VALUE rb_buffer, VALUE rb_type)
{
int error;
git_oid oid;
Check_Type(rb_buffer, T_STRING);
error = git_odb_hash(&oid,
RSTRING_PTR(rb_buffer),
RSTRING_LEN(rb_buffer),
rugged_otype_get(rb_type)
);
rugged_exception_check(error);
return rugged_create_oid(&oid);
}
|