git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 14, 2016, 17:21 UTC
Message-ID
<xmqq4megkrf9.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<5697CFEB.4090308@web.de>
Torsten Bögershausen <tboegi@web.de> 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.

Previous: Torsten BögershausenNext: Jeff King
Message 5 of 6 in “[issue?]'git branch -D' case sensitive issue”
  1. 郭腾飞Jan 14, 2016
  2. Torsten BögershausenJan 14, 2016
  3. 郭腾飞Jan 14, 2016
  4. Torsten BögershausenJan 14, 2016
  5. Junio C HamanoJan 14, 2016
  6. Jeff KingJan 15, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.