diff options
| author | Patrick Steinhardt <ps@pks.im> | 2015-09-16 12:10:11 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2017-02-13 10:13:02 +0100 |
| commit | c09fd54e2ecb5d43c281ee0fccef6d95787ec510 (patch) | |
| tree | 28fa64297f2f62ebb463e6694e33047eab5858fe /include/git2 | |
| parent | 807d57e7df1b7f71abc445523b88262b63b1b4e3 (diff) | |
| download | libgit2-c09fd54e2ecb5d43c281ee0fccef6d95787ec510.tar.gz | |
repository: introduce commondir variable
The commondir variable stores the path to the common directory.
The common directory is used to store objects and references
shared across multiple repositories. A current use case is the
newly introduced `git worktree` feature, which sets up a separate
working copy, where the backing git object store and references
are pointed to by the common directory.
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/repository.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h index 3d70d1b89..f60544553 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -393,6 +393,17 @@ GIT_EXTERN(const char *) git_repository_path(git_repository *repo); GIT_EXTERN(const char *) git_repository_workdir(git_repository *repo); /** + * Get the path of the shared common directory for this repository + * + * If the repository is bare is not a worktree, the git directory + * path is returned. + * + * @param repo A repository object + * @return the path to the common dir + */ +GIT_EXTERN(const char *) git_repository_commondir(git_repository *repo); + +/** * Set the path to the working directory for this repository * * The working directory doesn't need to be the same one |
