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

Re: Re-casing directories on case-insensitive systems

From
Dmitry Potapov <dpotapov@gmail.com>
Date
Jan 12, 2008, 14:46 UTC
Message-ID
<20080112144629.GE2963@dpotapov.dyndns.org>
In-Reply-To
<alpine.LFD.1.00.0801111356000.3148@woody.linux-foundation.org>
On Fri, Jan 11, 2008 at 02:08:35PM -0800, Linus Torvalds wrote:
Show 7 quoted lines
> 
> However, it's not like there is even a simple solution. The right place to 
> do that check would probably be in "add_index_entry()", but doing a check 
> whether the same file already exists (in a different case) is simply 
> *extremely* expensive for a very critical piece of code, unless we were to 
> change that index data structure a lot (ie add a separate hash for the 
> filenames).

After cursory look at the source code, I wonder if converting name1 and name2 to upper case before memcmp in cache_name_compare() can help case-insensitive systems. This change will change the order of file names in the index, but I suppose that it should not be a problem, because the index is host specific. Though, this fix is too simple, so I guess, I missed something.

> (And that's totally ignoring the fact that case-insensitivity then also 
> has tons of i18n issues and can get *really* messy 

The proper support of i18n is not simple even without case-insensitivity. For instance, there are four different encodings widely used for Russian letters. On Windows alone, you have two simulteniously in the default settings -- Windows-1251 for Windows applications and CP866 for Console applications... Actually, some console applications can change its default encoding, and it seems Cygwin programs do that. So, based on whether you use gcc from Cygwin or Visual C to compile your console program, you can get a different encoding. On *nix in Russia, koi8-r and utf-8 are most popular... So, if you have a repository shared between different systems, you cannot think about a file name just as a sequence of bytes anymore. OTOH, I doubt that many people are really interested in using non-ASCII file names with Git right now.

Dmitry
Previous: Johannes SchindelinNext: Linus Torvalds
Message 27 of 29 in “Re-casing directories on case-insensitive systems”
  1. Kevin BallardJan 11, 2008
  2. Kevin BallardJan 11, 2008
  3. Kevin BallardJan 11, 2008
  4. Linus TorvaldsJan 11, 2008
  5. Robin RosenbergJan 11, 2008
  6. Linus TorvaldsJan 11, 2008
  7. Johannes SchindelinJan 11, 2008
  8. Kevin BallardJan 11, 2008
  9. Johannes SchindelinJan 11, 2008
  10. Linus TorvaldsJan 11, 2008
  11. David KastrupJan 11, 2008
  12. Kevin BallardJan 11, 2008
  13. Robin RosenbergJan 11, 2008
  14. Kevin BallardJan 12, 2008
  15. Robin RosenbergJan 12, 2008
  16. Kevin BallardJan 12, 2008
  17. Junio C HamanoJan 12, 2008
  18. Johannes SchindelinJan 12, 2008
  19. Kevin BallardJan 12, 2008
  20. Junio C HamanoJan 12, 2008
  21. Kevin BallardJan 12, 2008
  22. David KastrupJan 12, 2008
  23. Dmitry PotapovJan 12, 2008
  24. Junio C HamanoJan 12, 2008
  25. Robin RosenbergJan 12, 2008
  26. Johannes SchindelinJan 12, 2008
  27. Dmitry PotapovJan 12, 2008
  28. Linus TorvaldsJan 12, 2008
  29. Dmitry PotapovJan 12, 2008

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.