From: Eric Sunshine Date: Sat, 11 Jul 2015 00:05:45 GMT Subject: [PATCH 15/16] worktree: populate via "git reset --hard" rather than "git checkout" Message-ID: <1436573146-3893-16-git-send-email-sunshine@sunshineco.com> In-Reply-To: <1436573146-3893-1-git-send-email-sunshine@sunshineco.com> Now that git-worktree handles all functionality (--force, --detach, -b/-B) previously delegated to git-checkout, actual population of the new worktree can be accomplished more directly and more lightweight with "git reset --hard" rather than "git checkout". Signed-off-by: Eric Sunshine --- builtin/worktree.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/worktree.c b/builtin/worktree.c index 9101a3c..51c57bc 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -262,7 +262,6 @@ static int add_worktree(const char *path, const char *refname, fprintf_ln(stderr, _("Enter %s (identifier %s)"), path, name); - setenv("GIT_CHECKOUT_NEW_WORKTREE", "1", 1); setenv(GIT_DIR_ENVIRONMENT, sb_git.buf, 1); setenv(GIT_WORK_TREE_ENVIRONMENT, path, 1); memset(&cp, 0, sizeof(cp)); @@ -280,7 +279,7 @@ static int add_worktree(const char *path, const char *refname, cp.argv = NULL; argv_array_clear(&cp.args); - argv_array_push(&cp.args, "checkout"); + argv_array_pushl(&cp.args, "reset", "--hard", NULL); ret = run_command(&cp); if (!ret) { is_junk = 0; -- 2.5.0.rc1.201.ga12d9f8