libgit2

git_odb_open

Version:

Create a new object database and automatically add the two default backends:

  • git_odb_backend_loose: read and write loose object files from disk, assuming objects_dir as the Objects folder
  • git_odb_backend_pack: read objects from packfiles, assuming objects_dir as the Objects folder which contains a 'pack/' folder with the corresponding data

Signature

int git_odb_open(git_odb **out, const char *objects_dir);

Parameters

In
out

location to store the database pointer, if opened. Set to NULL if the open failed.

const char *
In
objects_dir

path of the backends' "objects" directory.

Returns

int

GIT_SUCCESS if the database opened; otherwise an error code describing why the open was not possible.

Versions