summaryrefslogtreecommitdiff
path: root/builtin/worktree.c
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2015-07-17 23:00:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-07-20 18:29:52 (GMT)
commit1c56190aec502d946eb3db7365d6e54e2ffc7bd2 (patch)
treeeeacd225b72e0374f1929fbe77d120c3f3f31a6a /builtin/worktree.c
parented197a6ab983783550bd0b0c71cb97d734f4cfaa (diff)
downloadgit-1c56190aec502d946eb3db7365d6e54e2ffc7bd2.zip
git-1c56190aec502d946eb3db7365d6e54e2ffc7bd2.tar.gz
git-1c56190aec502d946eb3db7365d6e54e2ffc7bd2.tar.bz2
worktree: populate via "git reset --hard" rather than "git checkout"
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 lightweight with "git reset --hard" in place of "git checkout". Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/worktree.c')
-rw-r--r--builtin/worktree.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 4619308..5d9371c 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -266,7 +266,6 @@ static int add_worktree(const char *path, const char *refname,
fprintf_ln(stderr, _("Preparing %s (identifier %s)"), path, name);
- setenv("GIT_CHECKOUT_NEW_WORKTREE", "1", 1);
argv_array_pushf(&child_env, "%s=%s", GIT_DIR_ENVIRONMENT, sb_git.buf);
argv_array_pushf(&child_env, "%s=%s", GIT_WORK_TREE_ENVIRONMENT, path);
memset(&cp, 0, sizeof(cp));
@@ -285,7 +284,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);
cp.env = child_env.argv;
ret = run_command(&cp);
if (!ret) {