{"thread":{"id":"51035","subject":"Re: Git config \"ignorecase = true\" has issues","startedAt":"2019-05-05T10:11:55Z","lastAt":"2019-05-05T10:11:55Z","messageCount":1,"participants":["Ax Da"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"374908","messageId":"trinity-e0813b57-caed-41b4-bbed-a28e96060168-1557051105034@3c-app-gmx-bs61","threadId":"51035","inReplyTo":null,"subject":"Re: Git config \"ignorecase = true\" has issues","fromName":"Ax Da","fromEmail":"discussion@gmx.net","sentAt":"2019-05-05T10:11:45Z","receivedAt":"2019-05-05T10:11:55Z","isPatch":false,"sender":{"key":"discussion@gmx.net","avatar":null},"body":"Thanks for replying. Do you know how the query you mentioned (\"Do we have a file named \"file.txt\" on disk?\") is implemented in git?\n\nI'd suggest to use the C++ Windows API function FindFirstFileW() and then manually compare the result with the queried file name, like:\n\n\n\nbool fileExists(const WCHAR_T *fileName, bool ignoreCase)\n{\n  WIN32_FIND_DATAW fileData;\n  bool fileExists = false;\n  int (*strCmp)(const wchar_t *string1, const wchar_t *string2, size_t count)\n      = ignoreCase ? _wcsnicmp : wcsncmp;\n);\n\n  if (FindFirstFileW(fileName, fileData) != INVALID_HANDLE_VALUE)\n  {\n    if (!strCmp(fileName, fileData.cFileName, wcsnlen(fileName, MAX_PATH) + 1)) fileExists = true;\n \n    FindClose(fileData);\n  }\n \n  return fileExists;\n}\n\n\n\n---------------------------------------------------------------------------\n\nGesendet: Mittwoch, 24. April 2019 um 21:11 Uhr\nVon: \"Torsten Bögershausen\" <tboegi@web.de>\nAn: \"Ax Da\" <discussion@gmx.net>\nCc: git@vger.kernel.org\nBetreff: Re: Git config \"ignorecase = true\" has issues\nOn Fri, Apr 19, 2019 at 09:28:32PM +0200, Ax Da wrote:\n>\n> We're working on Windows machines and have been experiencing issues with the current implementation of Git with config setting \"core.ignorecase = true\" (which is the default on Windows machines and repositories created on Windows machines):\n>\n> Renaming files in a repository by only changing their case (changing a capital letter to its small equivalent and vice versa) is ignored by Git. Git retains the original case in the repository and all contributors will continue to see the ole file name which leads to confusion and issues with Open Source tools programmed to not ignore file name case.\n>\n> Currently there is no way to convey the new file name (only differing in case) to Git when \"core.ignorecase = true\".\n>\n> Hence, I propose to alter the behaviour of Git when \"core.ignorecase = true\": A repository's file name changes should be recognized as a RENAME operation and be propagated to the repository even when the new file name only differs from the old file name in case.\n\nYou can rename files like this:\ngit mv File.txt file.txt\ngit commit\n\nand Git will record the changes.\n\nThe main problem is, that after the rename, and may be on another machine after a pull,\nGit checks with the file system, if any updates in the working tree are needed.\nIn human speech, Git asks the file system:\nDo we have a file named \"file.txt\" on disk ?\nAnd Windows answers: Yes we have.\nEven if the file is named \"File.txt\" and Git asks for \"file.txt\".\n\nYou can try it yourself.\nRun\ncat File.txt\nunder the Git shell (bash)\nor\ntype File.txt\nunder cmd.exe\n\nThat is how it is.\n\nIf you really need the updated name \"file.txt\", you can delete all files in the worktree\nrm -rf *\nfollowed by\ngit reset --hard\n\nBut in any case, run\ngit status\nbefore and make sure that your working tree is clean.\n\n>\n> Thanks,\n> Axel Dahmen\n"}]}