git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Reuben Hawkins" <reubenhwk@gmail.com>,
	"Torsten Bögershausen" <tboegi@web.de>
Cc: git@vger.kernel.org, dpotapov@gmail.com
Subject: Re: [PATCH 1/2] init-db.c: honor case on case preserving fs
Date: Sun, 02 Feb 2014 10:08:46 -0800	[thread overview]
Message-ID: <xmqq7g9dgzf5.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <52ECE5EB.6090304@web.de> ("Torsten Bögershausen"'s message of "Sat, 01 Feb 2014 13:17:47 +0100")

Torsten Bögershausen <tboegi@web.de> writes:

> On 2014-02-01 10.14, Reuben Hawkins wrote:
>> Most case-insensitive filesystems are case-preserving. In these
>> filesystems (such as HFS+ on OS X) you can name a file Filename.txt,
>> then rename the file to FileName.txt.  That file will be accessible
>> by both filenames, but the case is otherwise honored.  We don't want
>> to have git ignore case on these case-preserving filesystem
>> implementations.
>
> Yes, we want.
> Because the file system will treat "Filename.txt" and "FileName.txt"
> the same.

Another important thing to remember is that we cannot have these two
files at the same time on such a filesystem.

Somebody may have Filename.txt in the commit at the tip of the
history, you clone/fetch and check it out, and you will have
Filename.txt with the original contents.  We do not try to corrupt
the filename on core.ignorecase filesystem by any canonicalization.

But then you may edit that file, and you either deliberately or
without knowing (because some of your tools do this behind your
back) may end up saving the result as FileName.txt.  What happens?

When we ask "what is the contents of Filename.txt now?" (using the
original name still in the index) to the underlying system, we will
be given what you placed in FileName.txt.  We won't see "You do not
have Filename.txt, but you now have FileName.txt".

And that is the behaviour the end users (of not Git, but of a
platform with such a filesystem) do expect from their tools.  They
do not want to see "You no longer have Filename.txt, and you have a
new file FileName.txt".

Now think what "git add Filename.txt" should do at that point?  It
should not say "I was told to add Filename.txt, but there is no such
file, so I'll add nothing".  If you run "git add -u Filename.txt",
it should not say "I was told to add Filename.txt, but there is no
such file, so I'll remove existing Filename.txt from the index".

It must pick up the updated contents from your new FileName.txt,
update the index entry "Filename.txt", and the next "git commit"
must record it as an update to the same file.

If you are on the other hand trying to correct an earlier mistake of
having named the file "Filename.txt" but you now want to rename it
"FileName.txt", the above behaviour by core.ignorecase may make it a
bit cumbersome to do.  You can first remove it from the index and
then re-add it, I would think, as a workaround.  Having to do a
"workaround" is unfortunate but it is an unavoidable consequence of
having to choose between the two and having to pick one.  Most of
the time you do not want such a rename (or rather, the loss of the
file Filename.txt and the creation of the unrelated FileName.txt)
and a change from Filename.txt to FileName.txt is most likely to be
a mistake in the platform tool that mucked with the files on your
filesystem, so we choose to make it easy for the user not to be
disturbed by such a change.

  parent reply	other threads:[~2014-02-02 18:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-01  9:14 [PATCH 1/2] init-db.c: honor case on case preserving fs Reuben Hawkins
2014-02-01  9:14 ` [PATCH 2/2] init-db.c: factor out probe_case_sensitivity func Reuben Hawkins
2014-02-01 12:17 ` [PATCH 1/2] init-db.c: honor case on case preserving fs Torsten Bögershausen
     [not found]   ` <CAD_8n+RWNZkGO31XveDuSy2aXv5uAMy087AUUu2+wXtO=MngAg@mail.gmail.com>
2014-02-01 23:47     ` Dmitry Potapov
2014-02-02 18:08   ` Junio C Hamano [this message]
     [not found] ` <CAHkcotg3McjrnQ_rLi4YpLAauMQT6U0kjEp1eu+6jxbuRY5zrA@mail.gmail.com>
     [not found]   ` <CAD_8n+TQ4i2Z5zePXCTqpdF8mpRrzzKjDUB-NxZ1PJAwek-y1w@mail.gmail.com>
2014-02-02  5:46     ` Dmitry Potapov

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=xmqq7g9dgzf5.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=dpotapov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=reubenhwk@gmail.com \
    --cc=tboegi@web.de \
    /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).