libgit2

git_repository_item_path

Version:

Get the location of a specific repository file or directory

This function will retrieve the path of a specific repository item. It will thereby honor things like the repository's common directory, gitdir, etc. In case a file path cannot exist for a given item (e.g. the working directory of a bare repository), GIT_ENOTFOUND is returned.

Signature

int git_repository_item_path(git_buf *out, const git_repository *repo, git_repository_item_t item);

Parameters

In
out

Buffer to store the path at

In
repo

Repository to get path for

In
item

The repository item for which to retrieve the path

Returns

int

0, GIT_ENOTFOUND if the path cannot exist or an error code

Versions