Re: Bug: git branch -D can be used to delete branch which is currently checked out - Part 2
- From
Jeff King <peff@peff.net>
- Date
- Mar 10, 2016, 22:41 UTC
- Message-ID
- <20160310224158.GA2772@sigill.intra.peff.net>
- In-Reply-To
- <9EFA8642-FA02-4ADB-B37B-530E611C9C1F@gmail.com>
On Fri, Mar 11, 2016 at 05:30:00AM +1100, Marcus Kida wrote:
> thank you for the feedback. > I will fix this, test it and send a patch.
Unfortunately, I think this issue is a little more complicated.
There's some prior discussion in
http://thread.gmane.org/gmane.comp.version-control.git/284022
and
http://thread.gmane.org/gmane.comp.version-control.git/276456/focus=276506
The latter, in particular, shows a case where this approach will do the wrong thing. The fundamental issue is that refs are potentially stored in _two_ places: the filesystem, and the packed-refs file. And the latter is always case-sensitive, while the former sometimes is and sometimes isn't. But because the storage all happens behind the scenes, the user has no way of reliably disambiguating (e.g., does "foo" refer to your checked-out "FOO", or are you intentionally trying to delete an extraneous "FOO" that ended up in the packed-refs file?).
-Peff