git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Philip Oakley" <philipoakley@iee.org>
To: "Git List" <git@vger.kernel.org>,
	"git-for-windows" <git-for-windows@googlegroups.com>
Cc: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Subject: Case insensitive branch names
Date: Mon, 21 Dec 2015 11:01:40 -0000	[thread overview]
Message-ID: <D350A5BC87B74A53B5BE4B10BC658208@PhilipOakley> (raw)

On the Git User's list, Diego J. reported that:

'When I "checkout" a branch using different Upper Case/Lower Case than the
original, the branch doesn't show in "git branch [--list]"' [1]

While case sensitivity for filenames is a common issue on Windows and the
like, I haven't seen any discussion regarding ref name sensitivity - any
pointers to past discussions?

In particular, if I have a branch 'nocase', and ask to checkout 'NoCase',
then git(-for-Windows) will happily say that 'NoCase' has been checked out,
but then it gets confusing.

We are both, not on any branch, and yet not detached. In fact HEAD points to
NoCase (which does not exist with that case setting). The checkout is
actually of 'nocase', and 'git branch' does not mark any branch ref current
(with the *). [see test script: 2].

While this is the way it is, should the 'git checkout' in some way check for
the branch case sensitivity issue?

For example, maybe simply correcting the checkout name to that as recorded
in the File System (but that has lots of code impact because the path and 
name are distinct elements of the branch struct), or maybe a warning could 
be emitted (config?), or even
an err/die.

My gut feeling was that, at least for refs, that something should be done.
My delving into the complexities of the code for 'git checkout' got me to
refs.c ~#L1603 where the requested path is lstat'd. Perhaps this point is a
special case for the mingw_lstat where the true pathname can be compared to
the requested pathname (or at least the refs/heads/name part) to detect this
mis-checkout case?

Thoughts? Is it a rabbit hole others have explored? Is it even worth 
pursuing?

--
Philip

[1] https://groups.google.com/forum/#!topic/git-users/EryCnwKL4_E
[2] Script
git init casetest
cd casetest/
>temp.txt
git add -A & git commit -m'first'
git status
git branch case
git branch
# two branches, * on master.
git status
git checkout Case
# successful checkout, uses branch name as given!
git branch
# note that no branch is marked as current, but neither are we detached 
head..
git status
cat .git/HEAD
# HEAD records the requested name, not the branch that was actually checked 
out!
# User left confused...

=== output
Philip@PhilipOakley MINGW32 /c
$ bash -v ./casetest.sh

git init casetest
Initialized empty Git repository in C:/casetest/.git/
cd casetest/
>temp.txt
git add -A & git commit -m'first'
[master (root-commit) 988c046] first
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 temp.txt
git status
On branch master
nothing to commit, working directory clean
git branch case
git branch
case
* master
# two branches, * on master.
git status
On branch master
nothing to commit, working directory clean
git checkout Case
Switched to branch 'Case'
# successful checkout, uses branch name as given!
git branch
case
master
# note that no branch is marked as current, but neither are we detached 
head..
git status
On branch Case
nothing to commit, working directory clean
cat .git/HEAD
ref: refs/heads/Case
# HEAD records the requested name, not the branch that was actually checked 
out!
# User left confused..
-- 

             reply	other threads:[~2015-12-21 11:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21 11:01 Philip Oakley [this message]
2015-12-21 12:21 ` [git-for-windows] Case insensitive branch names Duy Nguyen
2015-12-21 17:37   ` Junio C Hamano
2015-12-21 18:22     ` Torsten Bögershausen
2015-12-21 20:08       ` Philip Oakley

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=D350A5BC87B74A53B5BE4B10BC658208@PhilipOakley \
    --to=philipoakley@iee.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git-for-windows@googlegroups.com \
    --cc=git@vger.kernel.org \
    /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).