summaryrefslogtreecommitdiff
path: root/src/worktree.c
diff options
context:
space:
mode:
authorpunkymaniac <punkymaniac@protonmail.ch>2021-09-09 18:02:22 +0200
committerEdward Thomson <ethomson@edwardthomson.com>2021-12-23 14:21:49 -0600
commitffead012283cec68cafb3441e4be55030c94de74 (patch)
treefc146bd860d93b349c6c2e7f80ac3138c2aef42d /src/worktree.c
parenta50bbba18946cc7c457dc2ee376cf12b42a9b900 (diff)
downloadlibgit2-ffead012283cec68cafb3441e4be55030c94de74.tar.gz
Allow user checkout options on git_worktree_add
Extend the `git_worktree_add_options` to include `git_checkout_options`. github issue #5949
Diffstat (limited to 'src/worktree.c')
-rw-r--r--src/worktree.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/worktree.c b/src/worktree.c
index e08d6d401..caf4c58ed 100644
--- a/src/worktree.c
+++ b/src/worktree.c
@@ -405,7 +405,10 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
goto out;
/* Checkout worktree's HEAD */
- coopts.checkout_strategy = GIT_CHECKOUT_FORCE;
+ if (opts != NULL)
+ memcpy(&coopts, &wtopts.checkout_opts, sizeof(coopts));
+ else
+ coopts.checkout_strategy = GIT_CHECKOUT_FORCE;
if ((err = git_checkout_head(wt, &coopts)) < 0)
goto out;