Method: Rugged::Repository.hash_file
- Defined in:
- ext/rugged/rugged_repo.c
.hash_file(path, type) ⇒ Object
Hash the contents of the file pointed at by path
, assuming that it’d be stored in the ODB with the given type
, and return a hex string representing the SHA1 OID resulting from the hash.
Repository.hash_file('foo.txt', :commit) #=> "de5ba987198bcf2518885f0fc1350e5172cded78"
Repository.hash_file('foo.txt', :tag) #=> "9d09060c850defbc7711d08b57def0d14e742f4e"
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 |
# File 'ext/rugged/rugged_repo.c', line 1361
static VALUE rb_git_repo_hashfile(VALUE self, VALUE rb_path, VALUE rb_type)
{
int error;
git_oid oid;
FilePathValue(rb_path);
error = git_odb_hashfile(&oid,
StringValueCStr(rb_path),
rugged_otype_get(rb_type)
);
rugged_exception_check(error);
return rugged_create_oid(&oid);
}
|