worktree: make setup of new HEAD distinct from worktree population
commit7f44e3d1de08bf99c8dbd69d6437b712df369692
authorEric Sunshine <sunshine@sunshineco.com>
Fri, 17 Jul 2015 23:00:14 +0000 (17 19:00 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Jul 2015 18:29:52 +0000 (20 11:29 -0700)
treebdb0dc1f562e250d036d72073ceefad36041eeab
parentf7c9dac1b037e453e934c272d77cc648d56d5477
worktree: make setup of new HEAD distinct from worktree population

git-worktree currently conflates setting of HEAD in the new worktree and
initial worktree population into a single git-checkout invocation which
requires git-checkout to have special knowledge that it is operating on
a newly created worktree. The eventual goal is to rid git-checkout of
that overly-intimate knowledge.

Once these operations are separate, git-worktree will no longer be able
to delegate to git-branch the setting of the new worktree's HEAD to the
desired branch (or commit, if detached). Therefore, make git-worktree
itself responsible for setting up HEAD as either a symbolic reference,
if associated with a branch, or detached, if not.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c