diff options
| author | Russell Belfer <rb@github.com> | 2012-07-10 15:35:38 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2012-07-10 23:19:47 -0700 |
| commit | 991a56c704f931e7eb52a0583e5d8684803f3b04 (patch) | |
| tree | 28c0b9f7d113d5a55a060723516a9414d002c9f8 /include/git2 | |
| parent | b3ff1dab317dc9194c4bc124afd95ae9be2ad57b (diff) | |
| download | libgit2-991a56c704f931e7eb52a0583e5d8684803f3b04.tar.gz | |
Add flag to write gitlink on setting repo workdir
This added a flag to the `git_repository_set_workdir()` function
that enables generation of a `.git` gitlink file that links the
new workdir to the parent repository. Essentially, the flag tells
the function to write out the changes to disk to permanently set
the workdir of the repository to the new path.
If you pass this flag as true, then setting the workdir to something
other than the default workdir (i.e. the parent of the .git repo
directory), will create a plain file named ".git" with the standard
gitlink contents "gitdir: <repo-path>", and also update the
"core.worktree" and "core.bare" config values.
Setting the workdir to the default repo workdir will clear the
core.worktree flag (but still permanently set core.bare to false).
BTW, the libgit2 API does not currently provide a function for
clearing the workdir and converting a non-bare repo into a bare one.
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/repository.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h index 0b56a087..ff81b75e 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -194,9 +194,12 @@ GIT_EXTERN(const char *) git_repository_workdir(git_repository *repo); * * @param repo A repository object * @param workdir The path to a working directory + * @param update_gitlink Create/update gitlink in workdir and set config + * "core.worktree" (if workdir is not the parent of the .git directory) * @return 0, or an error code */ -GIT_EXTERN(int) git_repository_set_workdir(git_repository *repo, const char *workdir); +GIT_EXTERN(int) git_repository_set_workdir( + git_repository *repo, const char *workdir, int update_gitlink); /** * Check if a repository is bare |
