libgit2

git_repository_set_workdir

Version:

Set the path to the working directory for this repository

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

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

Signature

int git_repository_set_workdir(git_repository *repo, const char *workdir, int update_gitlink);

Parameters

In
repo

A repository object

const char *
In
workdir

The path to a working directory

int
In
update_gitlink

Create/update gitlink in workdir and set config "core.worktree" (if workdir is not the parent of the .git directory)

Returns

int

0, or an error code

Versions