]> git.ipfire.org Git - thirdparty/git.git/commit
switch: no worktree status unless real branch switch happens
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 29 Mar 2019 10:39:14 +0000 (17:39 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Apr 2019 04:57:00 +0000 (13:57 +0900)
commit65f099b3988198f0fdf3ef7a21dc01c556d21fff
tree2bb6c87990ea5fb171ac395bbe1305dd41f26dbc
parentccb111b342f472d12baddbfa5b52810da1725ffd
switch: no worktree status unless real branch switch happens

When we switch from one branch to another, it makes sense to show a
summary of local changes since there could be conflicts, or some files
left modified.... When switch is used solely for creating a new
branch (and "switch" to the same commit) or detaching, we don't really
need to show anything.

"git checkout" does it anyway for historical reasons. But we can start
with a clean slate with switch and don't have to.

This essentially reverts fa655d8411 (checkout: optimize "git checkout
-b <new_branch>" - 2018-08-16) and make it default for switch,
but also for -B and --detach. Users of big repos are encouraged to
move to switch.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/checkout.txt
builtin/checkout.c
t/t1090-sparse-checkout-scope.sh