libgit2

git_repository_init_ext

Version:

Create a new Git repository in the given folder with extended controls.

This will initialize a new git repository (creating the repo_path if requested by flags) and working directory as needed. It will auto-detect the case sensitivity of the file system and if the file system supports file mode bits correctly.

Note that the libgit2 library must be initialized using git_libgit2_init before any APIs can be called, including this one.

Signature

int git_repository_init_ext(git_repository **out, const char *repo_path, git_repository_init_options *opts);

Parameters

In
out

Pointer to the repo which will be created or reinitialized.

const char *
In
repo_path

The path to the repository.

In
opts

Pointer to git_repository_init_options struct.

Returns

int

0 or an error code on failure.

Versions