GitRepo.setWorkPath

Set the work path of this repository.

The work path doesn't need to be the same one that contains the .git folder for this repository.

If this repository is bare, setting its work path will turn it into a normal repository capable of performing all the common workdir operations (checkout, status, index manipulation, etc).

If updateGitlink equals UpdateGitlink.yes, gitlink will be created or updated in the work path. Additionally if the work path is not the parent of the .git directory the core.worktree option will be set in the configuration.

struct GitRepo
void
setWorkPath

Examples

1 // new bare repo work path is empty
2 auto repo = initRepo(_userRepo, OpenBare.yes);
3 scope(exit) rmdirRecurse(_userRepo);
4 assert(repo.workPath.relativePath.toPosixPath is null);
5 assert(repo.isBare);
6 
7 // set a new work path for the bare repo, verify it's set, and also
8 // verify repo is no longer a bare repo
9 repo.setWorkPath(_testRepo);
10 assert(repo.workPath.relativePath.toPosixPath == _testRepo);
11 assert(!repo.isBare);

Meta