{"thread":{"id":"54179","subject":"Repo state broken due to mismatched file name casing during merge","startedAt":"2020-09-02T16:26:50Z","lastAt":"2020-09-03T06:20:22Z","messageCount":3,"participants":["Rafał Grzybowski","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"404919","messageId":"CANG6M-ri1uvEPCcssP=Q0iM25Vhr5QZ220zUUhMdH4AVR9OLSw@mail.gmail.com","threadId":"54179","inReplyTo":null,"subject":"Repo state broken due to mismatched file name casing during merge","fromName":"Rafał Grzybowski","fromEmail":"aguyngueran@gmail.com","sentAt":"2020-09-02T16:26:27Z","receivedAt":"2020-09-02T16:26:50Z","isPatch":false,"sender":{"key":"aguyngueran@gmail.com","avatar":null},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\n\nmkdir repo\ncd repo\n\ngit init\n\n\"sample file\" > file.txt\ngit add file.txt\ngit commit -m \"Added file.txt\"\n\n\ngit checkout -b other_branch\necho other file > other_file.txt\ngit add other_file.txt\ngit commit -m \"Added other_file.txt\"\n\ngit checkout master\necho Other file > Other_file.txt\ngit add Other_file.txt\ngit commit -m \"Added Other_file.txt\"\n\ngit merge other_branch\ngit status\n\nWhat did you expect to happen? (Expected behavior)\n\nA clean state, no unstaged changes.\n\nWhat happened instead? (Actual behavior)\n\nThere is always an unstaged file other_file.txt which case changes if\nI try to discard and the unstaged change stays.\nIf I try to delete the file, I get two unstaged file removal changes.\n\nWhat's different between what you expected and what actually happened?\n\nThe state should be clean. It looks like the merge process broke\nsomething due to the casing.\n\nAnything else you want to add:\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.28.0.windows.1\ncpu: x86_64\nbuilt from commit: 77982caf269b7ee713a76da2bcf260c34d3bf7a7\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Windows 10.0 18363\ncompiler info: gnuc: 10.2\nlibc info: no libc information available\n$SHELL (typically, interactive shell): <unset>\n"},{"id":"404947","messageId":"20200902232309.GE241078@camp.crustytoothpaste.net","threadId":"54179","inReplyTo":"CANG6M-ri1uvEPCcssP=Q0iM25Vhr5QZ220zUUhMdH4AVR9OLSw@mail.gmail.com","subject":"Re: Repo state broken due to mismatched file name casing during merge","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-09-02T23:23:09Z","receivedAt":"2020-09-02T23:23:19Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-09-02 at 16:26:27, Rafał Grzybowski wrote:\n> What did you do before the bug happened? (Steps to reproduce your issue)\n> \n> mkdir repo\n> cd repo\n> \n> git init\n> \n> \"sample file\" > file.txt\n> git add file.txt\n> git commit -m \"Added file.txt\"\n> \n> \n> git checkout -b other_branch\n> echo other file > other_file.txt\n> git add other_file.txt\n> git commit -m \"Added other_file.txt\"\n> \n> git checkout master\n> echo Other file > Other_file.txt\n> git add Other_file.txt\n> git commit -m \"Added Other_file.txt\"\n> \n> git merge other_branch\n> git status\n> \n> What did you expect to happen? (Expected behavior)\n> \n> A clean state, no unstaged changes.\n> \n> What happened instead? (Actual behavior)\n> \n> There is always an unstaged file other_file.txt which case changes if\n> I try to discard and the unstaged change stays.\n> If I try to delete the file, I get two unstaged file removal changes.\n\nGit always preserves the case of files internally.  However, the default\nconfiguration on Windows does not.  When you performed this merge, you\nended up with two files, but it's not possible to write both of them\ninto the working tree.  Since they are not the same, when Git checks the\nstatus of one of the files, it finds it to be modified.\n\nThe solution here is to do \"git rm --cached Other_file.txt\" followed by\na commit.  That removes the file from the index but doesn't touch the\nworking tree.  In Windows 10, you can also set a directory to be case\nsensitive, which should fix this if you do a \"git checkout .\".\n\nThis isn't a bug in Git; Git doesn't know about file name encodings, and\neven if it only handled Unicode file names, it's impossible to correctly\nperform locale-insensitive case folding, so Git doesn't even try.\n-- \nbrian m. carlson: Houston, Texas, US\n"},{"id":"404958","messageId":"CANG6M-p-CEsNNY7jdhw0y5NndruBrwNqrtv_+m+irXFgm8hGkA@mail.gmail.com","threadId":"54179","inReplyTo":"20200902232309.GE241078@camp.crustytoothpaste.net","subject":"Re: Repo state broken due to mismatched file name casing during merge","fromName":"Rafał Grzybowski","fromEmail":"aguyngueran@gmail.com","sentAt":"2020-09-03T06:20:05Z","receivedAt":"2020-09-03T06:20:22Z","isPatch":false,"sender":{"key":"aguyngueran@gmail.com","avatar":null},"body":"Ok, I understand the behaviour now.\nThank you for your help :)\n"}]}