git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: 郭腾飞 <tfguo369@gmail.com>, git@vger.kernel.org
Subject: Re: [issue?]'git branch -D' case sensitive issue
Date: Thu, 14 Jan 2016 09:21:46 -0800	[thread overview]
Message-ID: <xmqq4megkrf9.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <5697CFEB.4090308@web.de> ("Torsten Bögershausen"'s message of "Thu, 14 Jan 2016 17:42:19 +0100")

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.

  reply	other threads:[~2016-01-14 17:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-14  7:52 [issue?]'git branch -D' case sensitive issue 郭腾飞
2016-01-14 11:51 ` Torsten Bögershausen
2016-01-14 13:28   ` 郭腾飞
2016-01-14 16:42     ` Torsten Bögershausen
2016-01-14 17:21       ` Junio C Hamano [this message]
2016-01-15 22:28         ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4megkrf9.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=tboegi@web.de \
    --cc=tfguo369@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).