diff options
author | Patrick Steinhardt <ps@pks.im> | 2018-02-09 10:38:11 +0000 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2018-02-09 10:40:59 +0000 |
commit | a22f19e6c4c0bf5205cd47dd66bfacd5c7d18136 (patch) | |
tree | fccaf92a98bd4a776f542c48326afbd17a35c4a5 /include/git2/worktree.h | |
parent | f7225946edeae35f48e3d402e2e0c94ea07f9666 (diff) | |
download | libgit2-a22f19e6c4c0bf5205cd47dd66bfacd5c7d18136.tar.gz |
worktree: add ability to create worktree with pre-existing branch
Currently, we always create a new branch after the new worktree's name
when creating a worktree. In some workflows, though, the caller may want
to check out an already existing reference instead of creating a new
one, which is impossible to do right now.
Add a new option `ref` to the options structure for adding worktrees. In
case it is set, a branch and not already checked out by another
worktree, we will re-use this reference instead of creating a new one.
Diffstat (limited to 'include/git2/worktree.h')
-rw-r--r-- | include/git2/worktree.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/git2/worktree.h b/include/git2/worktree.h index d3fa88e3f..7aed93777 100644 --- a/include/git2/worktree.h +++ b/include/git2/worktree.h @@ -78,10 +78,11 @@ typedef struct git_worktree_add_options { unsigned int version; int lock; /**< lock newly created worktree */ + git_reference *ref; /**< reference to use for the new worktree HEAD */ } git_worktree_add_options; #define GIT_WORKTREE_ADD_OPTIONS_VERSION 1 -#define GIT_WORKTREE_ADD_OPTIONS_INIT {GIT_WORKTREE_ADD_OPTIONS_VERSION,0} +#define GIT_WORKTREE_ADD_OPTIONS_INIT {GIT_WORKTREE_ADD_OPTIONS_VERSION,0,NULL} /** * Initializes a `git_worktree_add_options` with default vaules. |