GitRepo.path

Get the path of this repository.

This is the path of the .git folder for normal repositories, or of the repository itself for bare repositories.

Note: Submodule repositories will have their path set by the gitdir option in the .git file.

struct GitRepo
@property
string
path
(
)

Examples

// existing repo path
auto repo = openRepository(_testRepo);
assert(repo.path.relativePath.toPosixPath == ".git/modules/test/repo");
// new bare repo path is the path of the repo itself
auto repo = initRepo(_userRepo, OpenBare.yes);
scope(exit) rmdirRecurse(_userRepo);
assert(repo.path.relativePath.toPosixPath == "test/_myTestRepo");
// new non-bare repo path is the path of the .git directory
auto repo = initRepo(_userRepo, OpenBare.no);
scope(exit) rmdirRecurse(_userRepo);
assert(repo.path.relativePath.toPosixPath == "test/_myTestRepo/.git");

Meta