checkout: don't require a work tree when checking out into a new one
commitbb75e4c9ffd0c0f1edfbea9bf4d4f63e4e68ff1c
authorDennis Kaarsemaker <dennis@kaarsemaker.net>
Sun, 13 Jul 2014 04:51:08 +0000 (13 11:51 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Jul 2014 18:05:43 +0000 (17 11:05 -0700)
treec5ae3ddb3246808bfb2f4724bab1c2cbf74e71a5
parentc55b5575463ba5043d4b420acea392b2e903c9ee
checkout: don't require a work tree when checking out into a new one

For normal use cases, it does not make sense for 'checkout' to work on
a bare repository, without a worktree. But "checkout --to" is an
exception because it _creates_ a new worktree. Allow this option to
run on bare repositories.

People who check out from a bare repository should remember that
core.logallrefupdates is off by default and it should be turned back
on. `--to` cannot do this automatically behind the user's back because
some user may deliberately want no reflog.

For people interested in repository setup/discovery code,
is_bare_repository_cfg (aka "core.bare") is unchanged by this patch,
which means 'true' by default for bare repos. Fortunately when we get
the repo through a linked checkout, is_bare_repository_cfg is never
used. So all is still good.

[nd: commit message]

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c
git.c
t/t2025-checkout-to.sh