{"thread":{"id":"51120","subject":"Re: Git config \"ignorecase = true\" has issues","startedAt":"2019-05-18T12:59:19Z","lastAt":"2019-05-21T02:31:10Z","messageCount":3,"participants":["Ax Da","Johannes Sixt","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"375852","messageId":"trinity-4a160867-2036-4f8a-8363-7bf2e021d840-1558184320864@3c-app-gmx-bs48","threadId":"51120","inReplyTo":null,"subject":"Re: Git config \"ignorecase = true\" has issues","fromName":"Ax Da","fromEmail":"discussion@gmx.net","sentAt":"2019-05-18T12:58:40Z","receivedAt":"2019-05-18T12:59:19Z","isPatch":false,"sender":{"key":"discussion@gmx.net","avatar":null},"body":"Anyone who likes to fix this issue?\n-----------------------------------\n\n\nGesendet: Sonntag, 05. Mai 2019 um 12:11 Uhr\nVon: \"Ax Da\" <discussion@gmx.net>\nAn: unlisted-recipients:;\nCc: git@vger.kernel.org\nBetreff: Re: Git config \"ignorecase = true\" has issues\nThanks 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;\nint (*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"},{"id":"375858","messageId":"b75455b6-139a-aa6c-c7f6-7c9330e2ac6f@kdbg.org","threadId":"51120","inReplyTo":"trinity-4a160867-2036-4f8a-8363-7bf2e021d840-1558184320864@3c-app-gmx-bs48","subject":"Re: Git config \"ignorecase = true\" has issues","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-05-18T16:38:39Z","receivedAt":"2019-05-18T16:38:42Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 18.05.19 um 14:58 schrieb Ax Da:\n> You can rename files like this:\n> git mv File.txt file.txt\n\nOn a case-insensitive, case-preserving filesystem, a case-only rename\noperation is better performed in two steps that do not just change the case:\n\ngit mv File.txt  file.txtx\ngit mv file.txtx file.txt\n\n> git commit\n> \n> and Git will record the changes.\n\n-- Hannes\n"},{"id":"375977","messageId":"20190521023106.3sfrapksxg6xjtdg@tb-raspi4","threadId":"51120","inReplyTo":"b75455b6-139a-aa6c-c7f6-7c9330e2ac6f@kdbg.org","subject":"Re: Git config \"ignorecase = true\" has issues","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2019-05-21T02:31:06Z","receivedAt":"2019-05-21T02:31:10Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On Sat, May 18, 2019 at 06:38:39PM +0200, Johannes Sixt wrote:\n> Am 18.05.19 um 14:58 schrieb Ax Da:\n> > You can rename files like this:\n> > git mv File.txt file.txt\n>\n> On a case-insensitive, case-preserving filesystem, a case-only rename\n> operation is better performed in two steps that do not just change the case:\n>\n> git mv File.txt  file.txtx\n> git mv file.txtx file.txt\n\nIs this still needed in latest versions of Git, please see below  ?\nA quick test shows that both the file is renamed and the index is updated:\n\nuser@mac:~/projects/git/git.pu> git mv Makefile MAKEFILE\nuser@mac:~/projects/git/git.pu> ls -l MAKEFILE\n-rw-r--r--  1 tb  staff  100301 Apr 17 16:53 MAKEFILE\n\nuser@mac:~/projects/git/git.pu> git status\nHEAD detached at git.git/pu\nChanges to be committed:\n  (use \"git reset HEAD <file>...\" to unstage)\n\n        renamed:    Makefile -> MAKEFILE\n\n\n\n  commit baa37bff9a845471754d3f47957d58a6ccc30058\n  Author: David Turner <dturner@twitter.com>\n  Date:   Thu May 8 10:23:34 2014 -0700\n\n    mv: allow renaming to fix case on case insensitive filesystems\n\n    \"git mv hello.txt Hello.txt\" on a case insensitive filesystem\n     always triggers \"destination already exists\" error, because these\n    two names refer to the same path from the filesystem's point of\n    view, and requires the user to give \"--force\" when correcting the\n    case of the path recorded in the index and in the next commit.\n\n    Detect this case and allow it without requiring \"--force\".\n\n    Signed-off-by: David Turner <dturner@twitter.com>\n    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\n\n[snip]\n"}]}