libgit2

git_odb_hashfile

Version:

Read a file from disk and fill a git_oid with the object id that the file would have if it were written to the Object Database as an object of the given type. Similar functionality to git.git's git hash-object without the -w flag.

Signature

int git_odb_hashfile(git_oid *out, const char *path, git_otype type);

Parameters

In
out

oid structure the result is written into.

const char *
In
path

file to read and determine object id for

In
type

the type of the object that will be hashed

Returns

int

0 or an error code

Versions