symbolic-ref -d: do not allow removal of HEAD
commit12cfa792b8657cfd37523df83df0a83d987570a5
authorJunio C Hamano <gitster@pobox.com>
Thu, 1 Sep 2016 22:38:02 +0000 (1 15:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Sep 2016 16:01:38 +0000 (2 09:01 -0700)
tree8d79e6b3a0f2b1a4bf1e7b773a39d14751ff92c9
parente0c1ceafc5bece92d35773a75fff59497e1d9bd5
symbolic-ref -d: do not allow removal of HEAD

If you delete the symbolic-ref HEAD from a repository, Git no longer
considers the repository valid, and even "git symbolic-ref HEAD
refs/heads/master" would not be able to recover from that state
(although "git init" can, but that is a sure sign that you are
talking about a "broken" repository).

In the spirit similar to afe5d3d5 ("symbolic ref: refuse non-ref
targets in HEAD", 2009-01-29), forbid removal of HEAD to avoid
corrupting a repository.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/symbolic-ref.c
t/t1401-symbolic-ref.sh