libgit2

git_repository_open_ext

Version:

Find and open a repository with extended controls.

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_open_ext(git_repository **out, const char *path, unsigned int flags, const char *ceiling_dirs);

Parameters

Out
out

Pointer to the repo which will be opened. This can actually be NULL if you only want to use the error code to see if a repo at this path could be opened.

const char *
In
path

Path to open as git repository. If the flags permit "searching", then this can be a path to a subdirectory inside the working directory of the repository. May be NULL if flags is GIT_REPOSITORY_OPEN_FROM_ENV.

unsigned int
In
flags

A combination of the GIT_REPOSITORY_OPEN flags above.

const char *
In
ceiling_dirs

A GIT_PATH_LIST_SEPARATOR delimited list of path prefixes at which the search for a containing repository should terminate.

Returns

int

0 on success, GIT_ENOTFOUND if no repository could be found, or -1 if there was a repository but open failed for some reason (such as repo corruption or system errors).

Versions