diff options
| author | Patrick Steinhardt <ps@pks.im> | 2017-05-02 10:02:36 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2017-05-02 12:39:29 +0200 |
| commit | a7aa73a535a7f21357e9c7dece8376f30a29681f (patch) | |
| tree | ec7d9754e9e248c617b1953f071f66815aedda9d /include/git2/worktree.h | |
| parent | 7df580fae64fad8c6682208e297df806ff34385e (diff) | |
| download | libgit2-a7aa73a535a7f21357e9c7dece8376f30a29681f.tar.gz | |
worktree: introduce git_worktree_add options
The `git_worktree_add` function currently accepts only a path and name
for the new work tree. As we may want to expand these parameters in
future versions without adding additional parameters to the function for
every option, this commit introduces our typical pattern of an options
struct. Right now, this structure is still empty, which will change with
the next commit.
Diffstat (limited to 'include/git2/worktree.h')
| -rw-r--r-- | include/git2/worktree.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/include/git2/worktree.h b/include/git2/worktree.h index 4c4f9284d..bc1e40243 100644 --- a/include/git2/worktree.h +++ b/include/git2/worktree.h @@ -74,6 +74,25 @@ GIT_EXTERN(void) git_worktree_free(git_worktree *wt); */ GIT_EXTERN(int) git_worktree_validate(const git_worktree *wt); +typedef struct git_worktree_add_options { + unsigned int version; +} git_worktree_add_options; + +#define GIT_WORKTREE_ADD_OPTIONS_VERSION 1 +#define GIT_WORKTREE_ADD_OPTIONS_INIT {GIT_WORKTREE_ADD_OPTIONS_VERSION} + +/** + * Initializes a `git_worktree_add_options` with default vaules. + * Equivalent to creating an instance with + * GIT_WORKTREE_ADD_OPTIONS_INIT. + * + * @param opts the struct to initialize + * @param version Verison of struct; pass `GIT_WORKTREE_ADD_OPTIONS_VERSION` + * @return Zero on success; -1 on failure. + */ +int git_worktree_add_init_options(git_worktree_add_options *opts, + unsigned int version); + /** * Add a new working tree * @@ -85,9 +104,12 @@ GIT_EXTERN(int) git_worktree_validate(const git_worktree *wt); * @param repo Repository to create working tree for * @param name Name of the working tree * @param path Path to create working tree at + * @param opts Options to modify default behavior. May be NULL * @return 0 or an error code */ -GIT_EXTERN(int) git_worktree_add(git_worktree **out, git_repository *repo, const char *name, const char *path); +GIT_EXTERN(int) git_worktree_add(git_worktree **out, git_repository *repo, + const char *name, const char *path, + const git_worktree_add_options *opts); /** * Lock worktree if not already locked |
