Re: Should "git symbolic-ref -d HEAD" be forbidden?
- From
Jeff King <peff@peff.net>
- Date
- Sep 1, 2016, 21:19 UTC
- Message-ID
- <20160901211907.iivokwu3yjuxz3qf@sigill.intra.peff.net>
- In-Reply-To
- <xmqqpoonuy4n.fsf@gitster.mtv.corp.google.com>
On Thu, Sep 01, 2016 at 02:08:08PM -0700, Junio C Hamano wrote:
Show 16 quoted lines
> I think we should. > > t1401 expects to be able to, but if you really do it: > > $ cd /tmp > $ git init throwaway > $ cd throwaway > $ git symbolic-ref -d HEAD > > the setup machinery considers that you are no longer in a working > tree that is controlled by a repository at .git/ because .git/ is > no longer a valid repository, so you cannot even do > > $ git symbolic-ref HEAD refs/heads/master > > to recover.
Yes, I think we should, too. The same reasoning from afe5d3d (symbolic ref: refuse non-ref targets in HEAD, 2009-01-29) applies.
-Peff