Subject: Re: fast-import should not care about core.ignorecase

From: Junio C Hamano <[email-masked]>
Date: Tue, 09 Dec 2014 12:19:52 -0800

Joshua Jensen <[email-masked]> writes:

> Jonathan Nieder wrote on 12/8/2014 6:31 PM:
>> Joshua Jensen wrote:
>>> I think it has been discussed before, but maybe Git needs a
>>> core.casefold in addition to core.ignorecase.)
>> Would it work for --casefold to be a commandline flag to fast-import,
>> instead of a global option affecting multiple Git commands?
> Given that core.ignorecase=true means to fold filename case in quite a
> number of places within Git right now, I would expect the same
> behavior within a repository where fast-import is being run against
> core.ignorecase=true.
>
> So, I don't know what core.ignorecase should mean, but I'm pretty sure
> I know what core.foldcase should mean.
>
> Would --casefold work?  Sure, but it would be a special case against
> the existing core.ignorecase behavior that I don't think makes much
> sense.

I would recommend doing this:

 - Add file-scope static variable fast_import_casefold to fast-import.c

 - Patch fast-import.c where it calls strncmp_icase(a, b) to read

    fast_import_casefold ? strcasecmp(a, b) : strcmp(a, b);

 - Initialize fast_import_casefold to the same value as ignore_case.

 - Add a new command line option "--[no-]casefold" to modify the
   value of fast_import_casefold.

Once all of the above is in place, optionally do this:

 - Add fastImport.casefold configuration variable.  The
   initialization logic for fast_import_casefold would then become:

    1. If the configuration is set, use that value; otherwise
    2. Use the same value as ignore_case.

 - Start warning when fast_import_casefold is set to true only
   because ignore_case is set (i.e. no "--[no-casefold]" is given
   from the command line or from the config), saying that this is
   true for now only as a backward compatibility measure and in a
   later version of Git we will flip the default _not_ to fold on
   any system.

 - Wait a bit and then flip the default.