libgit2

git_blob_create_from_disk

Version:

Read a file from the filesystem (not necessarily inside the working folder of the repository) and write it to the object database.

Signature

int git_blob_create_from_disk(git_oid *id, git_repository *repo, const char *path);

Parameters

Out
id

return the id of the written blob

In
repo

repository where the blob will be written. this repository can be bare or not

const char *
In
path

file from which the blob will be created

Returns

int

0 or an error code

Versions