]> granicus.if.org Git - git/commit
switch: reject "do nothing" case
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 29 Mar 2019 10:39:10 +0000 (17:39 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Apr 2019 04:57:00 +0000 (13:57 +0900)
commite342c63a4e070bd1398b9aa86ac4ce917edbadc7
tree851c933ff4b53f79f4ff9f56e9f07536f9f23ee2
parent5c06e26903fd69cf7a71bf2cf8281a84868525b0
switch: reject "do nothing" case

"git checkout" can be executed without any arguments. What it does is
not exactly great: it switches from HEAD to HEAD and shows worktree
modification as a side effect.

Make switch reject this case. Just use "git status" if you want
that side effect. For switch, you have to either

- really switch a branch
- (explicitly) detach from the current branch
- create a new branch

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