[PATCH 2/4] builtin/worktree.c: Update checkout_worktree() to use git-worktree
- From
Jacob Abel <jacobabel@nullpo.dev>
- Date
- Nov 4, 2022, 01:03 UTC
- Message-ID
- <20221104010242.11555-3-jacobabel@nullpo.dev>
- In-Reply-To
- <20221104010242.11555-1-jacobabel@nullpo.dev>
Updates the function to call `git checkout` instead of `git reset --hard` to simplify adding orphan support.
Signed-off-by: Jacob Abel <jacobabel@nullpo.dev> --- builtin/worktree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/worktree.c b/builtin/worktree.c index b3373fbbd6..d40f771848 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -357,7 +357,7 @@ static int checkout_worktree(const struct add_opts *opts, { struct child_process cp = CHILD_PROCESS_INIT; cp.git_cmd = 1; - strvec_pushl(&cp.args, "reset", "--hard", "--no-recurse-submodules", NULL); + strvec_pushl(&cp.args, "checkout", "--no-recurse-submodules", NULL); if (opts->quiet) strvec_push(&cp.args, "--quiet"); strvec_pushv(&cp.env, child_env->v); -- 2.37.4