GitRepo.workPath

Get the path of the working directory of this repository.

If the repository is bare, this function will return null.

Note: Unlike path, this function is not affected by whether this repository is a submodule of another repository.

struct GitRepo
@property
string
workPath
(
)

Examples

// existing repo work path is different to the path of the .git directory,
// since this repo is a submodule
auto repo = openRepository(_testRepo);
assert(repo.workPath.relativePath.toPosixPath == "test/repo");
// new bare repo work path is empty
auto repo = initRepo(_userRepo, OpenBare.yes);
scope(exit) rmdirRecurse(_userRepo);
assert(repo.workPath.relativePath.toPosixPath is null);
// new non-bare repo work path is by default the directory path of the .git directory
auto repo = initRepo(_userRepo, OpenBare.no);
scope(exit) rmdirRecurse(_userRepo);
assert(repo.workPath.relativePath.toPosixPath == "test/_myTestRepo");

Meta