git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brandon Casey <drafnel@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, gitster@pobox.com, sunshine@sunshineco.com,
	bharrosh@panasas.com, trast@student.ethz.ch, zapped@mail.ru
Subject: Re: [PATCH 0/4] Honor core.ignorecase for attribute patterns
Date: Thu, 15 Sep 2011 15:28:33 -0500	[thread overview]
Message-ID: <CA+sFfMeLgdmUHq6YTymkC2bpMEGScQuwJ1SgyR0GGFjo-Gt=4g@mail.gmail.com> (raw)
In-Reply-To: <20110915181258.GA1227@sigill.intra.peff.net>

On Thu, Sep 15, 2011 at 1:12 PM, Jeff King <peff@peff.net> wrote:
> On Wed, Sep 14, 2011 at 08:59:35PM -0500, Brandon Casey wrote:
>
>> > I haven't even tested that it runs. :)  No, I was hoping someone
>> > who was more interested would finish it, and maybe even test on
>> > an affected system.
>>
>> Ok, I lied.  Here's a series that needs testing by people on a
>> case-insensitive filesystem and some comments.
>
> Thanks. I was trying to decide if I was interested enough to work on it,
> but procrastination wins again.
>
> I'm not sure I understand why you need a case-insensitive file system
> for the final set of tests. If we have a case-sensitive system, we can
> force the filesystem to show us whatever cases we want, and check
> against them with both core.ignorecase off and on[1]. What are these
> tests checking that requires the actual behavior of a case-insensitive
> filesystem?

This is probably way more detail than this feature deserves, but...

Those tests are making sure that git handles the case where the
.gitignore file resides in a subdirectory and the user supplies a path
that does not match the case in the filesystem.  In that
case^H^H^H^Hsituation, part of the path supplied by the user is
effectively interpreted case-insensitively, and part of it is
dependent on the setting of core.ignorecase.  git should only be
matching the portion of the path below the directory holding the
.gitignore file according to the setting of core.ignorecase.

Imagine a hierarchy that looks like this:

   .gitattributes
   a/.gitattributes

On a case-insensitive filesystem, if you supply the path A/B,
regardless of whether ignorecase is true or false, git will read the
a/.gitattributes file and use it.

Then if you have:

   $ cat a/.gitattributes
   b/c test=a/b/c

then you should get the following results:

   # the case of a/ does not affect the attr check
   $ git -c core.ignorecase=0 check-attr a/b/c
   a/b/c: test: a/b/c
   $ git -c core.ignorecase=0 check-attr A/b/c
   A/b/c: test: a/b/c
   $ git -c core.ignorecase=0 check-attr a/B/c
   a/B/c: test: unspecified
   $ git -c core.ignorecase=1 check-attr a/B/c
   a/B/c: test: a/b/c
   $ git -c core.ignorecase=0 check-attr A/B/c
   A/B/c: test: unspecified
   $ git -c core.ignorecase=1 check-attr A/B/c
   A/B/c: test: a/b/c
   etc.

On a case-sensitive filesystem, a/.gitattributes would never be read
if A/b/c was supplied, regardless of core.ignorecase.

This is also partly future-proofing.  Currently, git builds the attr
stack based on the path supplied by the user, so we don't have to do
anything special (like use strcmp_icase) to handle the parts of that
path that don't match the filesystem with respect to case.  If git
instead built the attr stack by scanning the repository, then the
paths in the origin field would not necessarily match the paths
supplied by the user.  If someone makes a change like that in the
future, these tests will notice.

> I'm sure there is something subtle that I'm missing. Can you explain it
> either here or in the commit message?

Yeah, that commit message was really just a place-holder.  I meant to
add WIP in the subject field of the last patch too.  I'll try to
explain some of the above when I reroll.

-Brandon

      reply	other threads:[~2011-09-15 20:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5XXEFw0WjtXKd9dpXSxpkskCcgVyG9Db1_zzVSEBNey-kpXSBbmQfYaxZ2Szg6Pbck6hZZTQ5hHzBwG4rhKYXshrdmveEFLPZ9W0V8P_lw@cipher.nrlssc.navy.mil>
2011-09-15  1:59 ` [PATCH 0/4] Honor core.ignorecase for attribute patterns Brandon Casey
2011-09-15  1:59   ` [PATCH 1/4] attr.c: avoid inappropriate access to strbuf "buf" member Brandon Casey
2011-09-15  1:59   ` [PATCH 2/4] cleanup: use internal memory allocation wrapper functions everywhere Brandon Casey
2011-09-15  6:52     ` Johannes Sixt
2011-09-15 15:39       ` Brandon Casey
     [not found]         ` <CA+sFfMf73K3yv_5K633DKOsVufMV6rTjd+SSunq4sBikt4jCsg@mail.gmail.com>
2011-10-06  2:00           ` Brandon Casey
2011-10-06  6:17             ` Johannes Sixt
2011-10-06  7:01               ` Alexey Shumkin
2011-10-06 16:14               ` Brandon Casey
2011-10-06 16:50                 ` Erik Faye-Lund
2011-10-06 16:52                   ` Erik Faye-Lund
2011-10-06 17:17                   ` Brandon Casey
2011-09-15  1:59   ` [PATCH 3/4] builtin/mv.c: plug miniscule memory leak Brandon Casey
2011-09-15  1:59   ` [PATCH 4/4] attr.c: respect core.ignorecase when matching attribute patterns Brandon Casey
2011-09-15  4:01     ` Junio C Hamano
2011-09-15  4:06       ` Junio C Hamano
2011-09-15 15:38         ` Brandon Casey
2011-09-15 18:12   ` [PATCH 0/4] Honor core.ignorecase for " Jeff King
2011-09-15 20:28     ` Brandon Casey [this message]

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='CA+sFfMeLgdmUHq6YTymkC2bpMEGScQuwJ1SgyR0GGFjo-Gt=4g@mail.gmail.com' \
    --to=drafnel@gmail.com \
    --cc=bharrosh@panasas.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    --cc=trast@student.ethz.ch \
    --cc=zapped@mail.ru \
    /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).