git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/6] Extensions of core.ignorecase=true support

From
Robert Buck <buck.robert.j@gmail.com>
Date
Aug 17, 2010, 19:36 UTC
Message-ID
<AANLkTi=0j_JFWBp=kJG6v+YBUxKAiVAVc4UtG0LWmipq@mail.gmail.com>
In-Reply-To
<cover.1281985411.git.j6t@kdbg.org>

While I tend to agree with case-insensitive searches, I would tend to question the use of a non-case-preserving / last-use methodology reminiscent of the days of DOS. I was never terribly fond of DOS nor of Windows for Workgroups, and this change smacks of that. That said, as an algorithm it is one legitimate option, I just would not tend to use it.

Have you thought of other approaches that are case-preserving / case-insensitive (modern Windows implementations and Mac OS X) or of case-sensitive (UNIX)? What about giving the user the choice?

Looking back at how flexible and simple folks here on this list made the EOL support (the best I have seen to date) what if you followed a similar approach and provided the flexibility to the users by giving the options to control the behavior themselves, then fall back to reasonable defaults if left unspecified?

I would imagine having two properties would be somewhat more useful:

core.casepreserving=true|false core.caseinsensitive=true|false

For Unix-centric environments the defaults would be true & false, respectively. For mixed Windows/Unix environments users would configure it as true & true. A combination of false & true, respectively, would be appropriate for DOS users, but this may be another option for mixed environments. A combination of false & false would be impossible by definition.

What this would mean is that searches in the purely Unix world would store and match sensitively; but in such an environment there may be issues should any Windows users attempt to work with the repository if two files having a similar names existed. For Windows users the last read operation would overwrite the first (not a good thing).

For mixed configurations there are two options, the Windows/Mac option, and the DOS option.

The nice thing about case-insensitivity is that when requesting a file by name any capitalization can be used. The bad thing, well come to think of it, there is none that I can think of, but for those more religious than I about Unix they may cite otherwise.

-Bob
On Mon, Aug 16, 2010 at 3:38 PM, Johannes Sixt <j6t@kdbg.org> wrote:
Show 52 quoted lines
> The following patch series extends the core.ignorecase=true support to
> handle case insensitive comparisons for the .gitignore file, git status,
> and git ls-files.  git add and git fast-import will fold the case of the
> file being added, matching that of an already added directory entry.  Case
> folding is also applied to git fast-import for renames, copies, and deletes.
>
> The most notable benefit, IMO, is that the case of directories in the
> worktree does not matter if, and only if, the directory exists already in
> the index with some different case variant.  This helps applications on
> Windows that change the case even of directories in unpredictable ways.
> Joshua mentioned Perforce as the primary example.
>
> Concerning the implementation, Joshua explained when he initially submitted
> the series to the msysgit mailing list:
>
>  git status and add both use an update made to name-hash.c where
>  directories, specifically names with a trailing slash, can be looked up
>  in a case insensitive manner. After trying a myriad of solutions, this
>  seemed to be the cleanest. Does anyone see a problem with embedding the
>  directory names in the same hash as the file names? I couldn't find one,
>  especially since I append a slash to each directory name.
>
>  The git add path case folding functionality is a somewhat radical
>  departure from what Git does now. It is described in detail in patch 5.
>  Does anyone have any concerns?
>
> I support the idea of this patch, and I can confirm that it works: I've
> used this series in production both with core.ignorecase set to true and
> to false, and in the former case, with directories and files with case
> different from the index.
>
> Joshua Jensen (6):
>  Add string comparison functions that respect the ignore_case
>    variable.
>  Case insensitivity support for .gitignore via core.ignorecase
>  Add case insensitivity support for directories when using git status
>  Add case insensitivity support when using git ls-files
>  Support case folding for git add when core.ignorecase=true
>  Support case folding in git fast-import when core.ignorecase=true
>
>  dir.c         |  105 ++++++++++++++++++++++++++++++++++++++++++++++----------
>  dir.h         |    4 ++
>  fast-import.c |    7 ++--
>  name-hash.c   |   72 ++++++++++++++++++++++++++++++++++++++-
>  read-cache.c  |   23 ++++++++++++
>  5 files changed, 188 insertions(+), 23 deletions(-)
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Previous: Johannes SixtNext: Johannes Sixt
Message 22 of 26 in “Extensions of core.ignorecase=true support”
  1. 0/6 Extensions of core.ignorecase=true supportJohannes Sixt, Aug 16, 2010
  2. 1/6 Add string comparison functions that respect the ignore_case variable.Johannes Sixt, Aug 16, 2010
  3. Ævar Arnfjörð BjarmasonAug 18, 2010
  4. Ævar Arnfjörð BjarmasonAug 18, 2010
  5. Joshua JensenAug 18, 2010
  6. Ævar Arnfjörð BjarmasonAug 18, 2010
  7. Johannes SixtAug 18, 2010
  8. Ævar Arnfjörð BjarmasonAug 18, 2010
  9. Ævar Arnfjörð BjarmasonAug 29, 2010
  10. Joshua JensenAug 30, 2010
  11. Ævar Arnfjörð BjarmasonAug 30, 2010
  12. Jonathan NiederAug 30, 2010
  13. Jonathan NiederAug 30, 2010
  14. Johannes SixtAug 30, 2010
  15. Ævar Arnfjörð BjarmasonAug 30, 2010
  16. Johannes SixtAug 30, 2010
  17. 2/6 Case insensitivity support for .gitignore via core.ignorecaseJohannes Sixt, Aug 16, 2010
  18. 3/6 Add case insensitivity support for directories when using git statusJohannes Sixt, Aug 16, 2010
  19. 4/6 Add case insensitivity support when using git ls-filesJohannes Sixt, Aug 16, 2010
  20. 5/6 Support case folding for git add when core.ignorecase=trueJohannes Sixt, Aug 16, 2010
  21. 6/6 Support case folding in git fast-import when core.ignorecase=trueJohannes Sixt, Aug 16, 2010
  22. Robert BuckAug 17, 2010
  23. Johannes SixtAug 17, 2010
  24. Robert BuckAug 18, 2010
  25. Johannes SixtAug 18, 2010
  26. Junio C HamanoAug 22, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.