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

Re: Bug: Changing folder case with `git mv` crashes on case-insensitive file system

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
May 5, 2021, 02:12 UTC
Message-ID
<YJH/J+ungqbqT3Zb@camp.crustytoothpaste.net>
In-Reply-To
<xmqqtuni58ra.fsf@gitster.g>
On 2021-05-05 at 00:23:05, Junio C Hamano wrote:
Show 16 quoted lines
> Torsten Bögershausen <tboegi@web.de> writes:
> 
> > To my undestanding we try to rename
> > foo/ into FOO/.
> > But because FOO/ already "exists" as directory,
> > Git tries to move foo/ into FOO/foo, which fails.
> >
> > And no, the problem is probably not restricted to MacOs,
> > Windows and all case-insenstive file systems should show
> > the same, but I haven't tested yet, so it's more a suspicion.
> >
> > The following diff allows to move foo/ into FOO/
> > If someone wants to make a patch out if, that would be good.
> 
> Is strcasecmp() sufficient for macOS whose filesystem has not just
> case insensitivity but UTF-8 normalization issues?

strcasecmp is locale sensitive, so I would say it is not a good choice here. Notably, that means we have differing behavior with "i" and "I" if the locale is Turkish versus English. Only one of those behaviors will be a correct match for what the kernel does, since it is not locale sensitive. Moreover, on Windows, the version of Unicode used for case mapping is written into an NTFS file system when it's created, so a fresh install may have different behavior from an upgrade, and strcasecmp won't honor that.

And, as you pointed out, it doesn't handle Unicode normalization at all.
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Junio C HamanoNext: Torsten Bögershausen
Message 9 of 14 in “Bug: Changing folder case with `git mv` crashes on case-insensitive file system”
  1. Mark AmeryMay 3, 2021
  2. brian m. carlsonMay 3, 2021
  3. Junio C HamanoMay 4, 2021
  4. brian m. carlsonMay 4, 2021
  5. Johannes SchindelinMay 5, 2021
  6. Junio C HamanoMay 6, 2021
  7. Torsten BögershausenMay 4, 2021
  8. Junio C HamanoMay 5, 2021
  9. brian m. carlsonMay 5, 2021
  10. Torsten BögershausenMay 6, 2021
  11. Mark AmeryMay 6, 2021
  12. Bagas SanjayaMay 6, 2021
  13. Torsten BögershausenMay 6, 2021
  14. Junio C HamanoMay 6, 2021

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.