Subject: Re: [issue?]'git branch -D' case sensitive issue

From: Junio C Hamano <[email-masked]>
Date: Thu, 14 Jan 2016 09:21:46 -0800

Torsten Bögershausen <[email-masked]> writes:

> No, this is typically what we observe on a case insensitive FS.

There is an interesting bit in delete_branches::builtin/branch.c

	if (kinds == FILTER_REFS_BRANCHES && !strcmp(head, bname.buf)) {
		error(_("Cannot delete the branch '%s' "
		      "which you are currently on."), bname.buf);
		ret = 1;
		continue;
	}

The strcmp() does not protect you from attempting to remove "FrOtZ"
branch when you are on (and more importantly, Git thinks you are on)
"frotz" branch.  A case-insensitive system then can tell Git that
the request to remove "refs/heads/FrOtZ" succeeded, even though in
reality it didn't have such file, and silently "refs/heads/frotz"
gets removed instead.  You can end up removing your current branch
that way.