{"thread":{"id":"35102","subject":"Bug report: OS X git-merge deletes recapitalized files when rename detection fails","startedAt":"2013-10-10T22:46:34Z","lastAt":"2013-10-22T04:27:37Z","messageCount":2,"participants":["Dan Fabulich"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"228721","messageId":"83737702-F966-457E-A77D-85CCD06FFECA@fabulich.com","threadId":"35102","inReplyTo":null,"subject":"Bug report: OS X git-merge deletes recapitalized files when rename detection fails","fromName":"Dan Fabulich","fromEmail":"dan@fabulich.com","sentAt":"2013-10-10T22:46:34Z","receivedAt":"2013-10-10T22:46:34Z","isPatch":false,"sender":{"key":"dan@fabulich.com","avatar":"https://gravatar.com/avatar/884cee2af623b7675bebdd7b70b13dcb8423150d8f137ec0841859b80a21cd05?d=mp&s=160"},"body":"On case-insensitive filesystems, git-merge deletes files that were recapitalized in another branch if rename detection fails.\n\nTo repro: Run this script with git 1.8.4 on a case-insensitive filesystem. It repros for me on the default HFS filesystem on OS X 10.8, and also on Win7 NTFS.\n\n#!/bin/sh -x\n# create git repo\ngit --version\nrm -rf caps\ngit init caps\ncd caps\ngit config --get core.ignorecase\n# commit empty file called \"file\"\necho file > file\ngit add .\ngit commit -am \"initial commit\"\n# create branch called \"branch\"\ngit branch branch\n# rename \"file\" to \"File\"\n# using --force per http://stackoverflow.com/questions/6899582\ngit mv --force file File\necho \"completely different content\" > File\ngit commit -am \"renamed to File\"\n# switch to branch, make a non-conflicting commit\ngit checkout branch\necho newfile > newfile\ngit add .\ngit commit -am \"branch commit\"\n# merge master into branch, commit merge\ngit merge --verbose --commit --no-edit master\nls File\ngit status\n\nActual: At the end of the script, the renamed File has been deleted by git-merge. \"ls: File: No such file or directory\" According to git-status, the deletion is not yet staged.\n\nExpected: There should be no untracked changes at the end of this script. The script runs as expected on Linux or case-sensitive HFS.\n\n-Dan Fabulich\n\nP.S. On case-insensitive HFS, git-init will automatically set core.ignorecase to true. For the sake of the experiment, I also tried setting core.ignorecase to false in the test repository.\n\nWhen I did that, I was unable to even checkout the \"branch\" branch without using --force. (\"The following untracked working tree files would be overwritten by checkout: file\" But git-status reported no untracked changes.)\n\nAnd then, once I did use force to switch to the branch, I was unable to merge from master at all. (\"The following untracked working tree files would be overwritten by merge: File\" But again, git-status reported no untracked changes.)\n"},{"id":"229269","messageId":"55E4066B-A15A-47DF-AD84-49268DA4B31F@fabulich.com","threadId":"35102","inReplyTo":"1BABBB4C-F461-40B7-97C6-3E90364D37E8@gmail.com","subject":"Re: Bug report: OS X git-merge deletes recapitalized files when rename detection fails","fromName":"Dan Fabulich","fromEmail":"dan@fabulich.com","sentAt":"2013-10-22T04:27:37Z","receivedAt":"2013-10-22T04:27:37Z","isPatch":false,"sender":{"key":"dan@fabulich.com","avatar":"https://gravatar.com/avatar/884cee2af623b7675bebdd7b70b13dcb8423150d8f137ec0841859b80a21cd05?d=mp&s=160"},"body":"Eric, are you still investigating this bug? (I note that your reply, which cc:ed the list, doesn't seem to have been mailed out to the list, or added to mailing list archives.)\n\nOn Oct 10, 2013, at 17:13 , Eric Boxer <boxerspam1@gmail.com> wrote:\n\n> I'm on it and I'll follow up shortly.\n> \n> \n> On Thu, Oct 10, 2013 at 05:46 PM, Dan Fabulich wrote:\n>> On case-insensitive filesystems, git-merge deletes files that were recapitalized in another branch if rename detection fails.\n>> \n>> To repro: Run this script with git 1.8.4 on a case-insensitive filesystem. It repros for me on the default HFS filesystem on OS X 10.8, and also on Win7 NTFS.\n>> \n>> #!/bin/sh -x\n>> # create git repo\n>> git --version\n>> rm -rf caps\n>> git init caps\n>> cd caps\n>> git config --get core.ignorecase\n>> # commit empty file called \"file\"\n>> echo file > file\n>> git add .\n>> git commit -am \"initial commit\"\n>> # create branch called \"branch\"\n>> git branch branch\n>> # rename \"file\" to \"File\"\n>> # using --force per http://stackoverflow.com/questions/6899582\n>> git mv --force file File\n>> echo \"completely different content\" > File\n>> git commit -am \"renamed to File\"\n>> # switch to branch, make a non-conflicting commit\n>> git checkout branch\n>> echo newfile > newfile\n>> git add .\n>> git commit -am \"branch commit\"\n>> # merge master into branch, commit merge\n>> git merge --verbose --commit --no-edit master\n>> ls File\n>> git status\n>> \n>> Actual: At the end of the script, the renamed File has been deleted by git-merge. \"ls: File: No such file or directory\" According to git-status, the deletion is not yet staged.\n>> \n>> Expected: There should be no untracked changes at the end of this script. The script runs as expected on Linux or case-sensitive HFS.\n>> \n>> -Dan Fabulich\n>> \n>> P.S. On case-insensitive HFS, git-init will automatically set core.ignorecase to true. For the sake of the experiment, I also tried setting core.ignorecase to false in the test repository.\n>> \n>> When I did that, I was unable to even checkout the \"branch\" branch without using --force. (\"The following untracked working tree files would be overwritten by checkout: file\" But git-status reported no untracked changes.)\n>> \n>> And then, once I did use force to switch to the branch, I was unable to merge from master at all. (\"The following untracked working tree files would be overwritten by merge: File\" But again, git-status reported no untracked changes.)\n>> \n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at http://vger.kernel.org/majordomo-info.html\n"}]}