{"thread":{"id":"38489","subject":"folder naming bug?","startedAt":"2015-02-03T01:56:39Z","lastAt":"2015-02-03T08:40:29Z","messageCount":7,"participants":["Kevin Coleman","Bryan Turner","Jeff King","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"255554","messageId":"27503C0E-7D33-4893-AD25-6A821D31FAB1@sparkstart.io","threadId":"38489","inReplyTo":null,"subject":"folder naming bug?","fromName":"Kevin Coleman","fromEmail":"kevin.coleman@sparkstart.io","sentAt":"2015-02-03T01:56:39Z","receivedAt":"2015-02-03T01:56:39Z","isPatch":false,"sender":{"key":"kevin.coleman@sparkstart.io","avatar":null},"body":"git isn’t tracking folder renames when the case of the letters change, but it will track it if the folder changes names.  Is this intentional?\n\nHere is an example:\n\n08:51:26 ~/test $ git init\nInitialized empty Git repository in /Users/kcoleman/test/.git/\n08:51:29 ~/test (master #) $ mkdir main\n08:51:44 ~/test (master #) $ cd main\n08:51:46 ~/test/main (master #) $ touch readme.md\n08:51:50 ~/test/main (master #) $ ls\nreadme.md\n08:51:53 ~/test/main (master #) $ cd ..\n08:51:54 ~/test (master #) $ git add .\n08:51:59 ~/test (master #) $ git commit -m \"one\"\n[master (root-commit) b0fddf6] one\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 main/readme.md\n08:52:04 ~/test (master) $ cd main\n08:52:14 ~/test/main (master) $ cd ..\n08:52:27 ~/test (master) $ mv main Main\n08:53:51 ~/test (master) $ git status\nOn branch master\nnothing to commit, working directory clean\n08:53:53 ~/test (master) $ ls\nMain\n08:54:02 ~/test (master) $ mv Main MainA\n08:55:44 ~/test (master *) $ git status\nOn branch master\nChanges not staged for commit:\n  (use \"git add/rm <file>...\" to update what will be committed)\n  (use \"git checkout -- <file>...\" to discard changes in working directory)\n\n\tdeleted:    main/readme.md\n\nUntracked files:\n  (use \"git add <file>...\" to include in what will be committed)\n\n\tMainA/\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n08:55:45 ~/test (master *) $"},{"id":"255557","messageId":"CAGyf7-FXhhW74DvcO8nbWud9A868AYqKj_zY61wmf9XGvH4eQA@mail.gmail.com","threadId":"38489","inReplyTo":"27503C0E-7D33-4893-AD25-6A821D31FAB1@sparkstart.io","subject":"Re: folder naming bug?","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2015-02-03T04:37:19Z","receivedAt":"2015-02-03T04:37:19Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"Are you, by any chance, on MacOS? HFS+ by default is\ncase-insensitive-but-case-preserving, and Git on MacOS by default runs\nwith core.ignorecase = true as a result.\n\nIf you set that to false does it change the behavior?\n\nHope this helps,\nBryan Turner\n\nOn Tue, Feb 3, 2015 at 12:56 PM, Kevin Coleman\n<kevin.coleman@sparkstart.io> wrote:\n> git isn’t tracking folder renames when the case of the letters change, but it will track it if the folder changes names.  Is this intentional?\n>\n> Here is an example:\n>\n> 08:51:26 ~/test $ git init\n> Initialized empty Git repository in /Users/kcoleman/test/.git/\n> 08:51:29 ~/test (master #) $ mkdir main\n> 08:51:44 ~/test (master #) $ cd main\n> 08:51:46 ~/test/main (master #) $ touch readme.md\n> 08:51:50 ~/test/main (master #) $ ls\n> readme.md\n> 08:51:53 ~/test/main (master #) $ cd ..\n> 08:51:54 ~/test (master #) $ git add .\n> 08:51:59 ~/test (master #) $ git commit -m \"one\"\n> [master (root-commit) b0fddf6] one\n>  1 file changed, 0 insertions(+), 0 deletions(-)\n>  create mode 100644 main/readme.md\n> 08:52:04 ~/test (master) $ cd main\n> 08:52:14 ~/test/main (master) $ cd ..\n> 08:52:27 ~/test (master) $ mv main Main\n> 08:53:51 ~/test (master) $ git status\n> On branch master\n> nothing to commit, working directory clean\n> 08:53:53 ~/test (master) $ ls\n> Main\n> 08:54:02 ~/test (master) $ mv Main MainA\n> 08:55:44 ~/test (master *) $ git status\n> On branch master\n> Changes not staged for commit:\n>   (use \"git add/rm <file>...\" to update what will be committed)\n>   (use \"git checkout -- <file>...\" to discard changes in working directory)\n>\n>         deleted:    main/readme.md\n>\n> Untracked files:\n>   (use \"git add <file>...\" to include in what will be committed)\n>\n>         MainA/\n>\n> no changes added to commit (use \"git add\" and/or \"git commit -a\")\n> 08:55:45 ~/test (master *) $--\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"},{"id":"255558","messageId":"06E0624C-2484-476D-A32F-B586062EC230@sparkstart.io","threadId":"38489","inReplyTo":"CAGyf7-FXhhW74DvcO8nbWud9A868AYqKj_zY61wmf9XGvH4eQA@mail.gmail.com","subject":"Re: folder naming bug?","fromName":"Kevin Coleman","fromEmail":"kevin.coleman@sparkstart.io","sentAt":"2015-02-03T04:52:21Z","receivedAt":"2015-02-03T04:52:21Z","isPatch":false,"sender":{"key":"kevin.coleman@sparkstart.io","avatar":null},"body":"Sorry for sending x2.  I got a bounce notification the first time.\n\n====\nYes, I am on a Mac.  I just tried that, but I don’t think that completely fixed it.  As you can see it tracks “foo/bar.md” and then it tracks “Foo/bar.md”.  It still tracks both “foo” and “Foo” even tho only “Foo” exists in my dir after the rename.\n\nI create a public repo on github with this repo https://github.com/KevinColemanInc/test\n\nI am running git version 2.2.2.\n\n11:41:57 ~/test $ git init\nInitialized empty Git repository in /Users/kcoleman/test/.git/\n11:42:03 ~/test (master #) $ git config core.ignorecase false\n11:42:06 ~/test (master #) $ mkdir foo\n11:42:13 ~/test (master #) $ cd foo\n11:42:26 ~/test/foo (master #) $ touch bar.md\n11:42:30 ~/test/foo (master #) $ cd ..\n11:42:32 ~/test (master #) $ git add .\n11:42:35 ~/test (master #) $ git commit -m \"first\"\n[master (root-commit) 6125a1d] first\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 foo/bar.md\n11:42:39 ~/test (master) $ mv foo Foo\n11:42:44 ~/test (master) $ ls\nFoo\n11:42:46 ~/test (master) $ git status\nOn branch master\nUntracked files:\n  (use \"git add <file>...\" to include in what will be committed)\n\n\tFoo/\n\nnothing added to commit but untracked files present (use \"git add\" to track)\n11:42:48 ~/test (master) $ git add .\n11:43:18 ~/test (master +) $ git commit -m \"second\"\n[master f78d025] second\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 Foo/bar.md\n\n-Kevin Coleman\n\n> On Feb 2, 2015, at 11:37 PM, Bryan Turner <bturner@atlassian.com> wrote:\n> \n> Are you, by any chance, on MacOS? HFS+ by default is\n> case-insensitive-but-case-preserving, and Git on MacOS by default runs\n> with core.ignorecase = true as a result.\n> \n> If you set that to false does it change the behavior?\n> \n> Hope this helps,\n> Bryan Turner\n> \n> On Tue, Feb 3, 2015 at 12:56 PM, Kevin Coleman\n> <kevin.coleman@sparkstart.io> wrote:\n>> git isn’t tracking folder renames when the case of the letters change, but it will track it if the folder changes names.  Is this intentional?\n>> \n>> Here is an example:\n>> \n>> 08:51:26 ~/test $ git init\n>> Initialized empty Git repository in /Users/kcoleman/test/.git/\n>> 08:51:29 ~/test (master #) $ mkdir main\n>> 08:51:44 ~/test (master #) $ cd main\n>> 08:51:46 ~/test/main (master #) $ touch readme.md\n>> 08:51:50 ~/test/main (master #) $ ls\n>> readme.md\n>> 08:51:53 ~/test/main (master #) $ cd ..\n>> 08:51:54 ~/test (master #) $ git add .\n>> 08:51:59 ~/test (master #) $ git commit -m \"one\"\n>> [master (root-commit) b0fddf6] one\n>> 1 file changed, 0 insertions(+), 0 deletions(-)\n>> create mode 100644 main/readme.md\n>> 08:52:04 ~/test (master) $ cd main\n>> 08:52:14 ~/test/main (master) $ cd ..\n>> 08:52:27 ~/test (master) $ mv main Main\n>> 08:53:51 ~/test (master) $ git status\n>> On branch master\n>> nothing to commit, working directory clean\n>> 08:53:53 ~/test (master) $ ls\n>> Main\n>> 08:54:02 ~/test (master) $ mv Main MainA\n>> 08:55:44 ~/test (master *) $ git status\n>> On branch master\n>> Changes not staged for commit:\n>>  (use \"git add/rm <file>...\" to update what will be committed)\n>>  (use \"git checkout -- <file>...\" to discard changes in working directory)\n>> \n>>        deleted:    main/readme.md\n>> \n>> Untracked files:\n>>  (use \"git add <file>...\" to include in what will be committed)\n>> \n>>        MainA/\n>> \n>> no changes added to commit (use \"git add\" and/or \"git commit -a\")\n>> 08:55:45 ~/test (master *) $--\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"},{"id":"255559","messageId":"20150203052317.GA1262@peff.net","threadId":"38489","inReplyTo":"06E0624C-2484-476D-A32F-B586062EC230@sparkstart.io","subject":"Re: folder naming bug?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-02-03T05:23:17Z","receivedAt":"2015-02-03T05:23:17Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Feb 02, 2015 at 11:52:21PM -0500, Kevin Coleman wrote:\n\n> Yes, I am on a Mac.  I just tried that, but I don’t think that\n> completely fixed it.  As you can see it tracks “foo/bar.md” and then\n> it tracks “Foo/bar.md”.  It still tracks both “foo” and “Foo” even tho\n> only “Foo” exists in my dir after the rename.\n\nYes, because your filesystem _is_ case insensitive, but now you have\ntold git that it is not. In your example:\n\n> 11:41:57 ~/test $ git init\n> Initialized empty Git repository in /Users/kcoleman/test/.git/\n> 11:42:03 ~/test (master #) $ git config core.ignorecase false\n> 11:42:06 ~/test (master #) $ mkdir foo\n> 11:42:13 ~/test (master #) $ cd foo\n> 11:42:26 ~/test/foo (master #) $ touch bar.md\n> 11:42:30 ~/test/foo (master #) $ cd ..\n> 11:42:32 ~/test (master #) $ git add .\n\nNow git has \"foo\" (lowercase) in the index. And that's what your\nfilesystem has, too.\n\n> 11:42:35 ~/test (master #) $ git commit -m \"first\"\n> [master (root-commit) 6125a1d] first\n>  1 file changed, 0 insertions(+), 0 deletions(-)\n>  create mode 100644 foo/bar.md\n> 11:42:39 ~/test (master) $ mv foo Foo\n> 11:42:44 ~/test (master) $ ls\n> Foo\n\nNow we still have \"foo\" in the index, but \"Foo\" in the filesystem.\n\n> 11:42:46 ~/test (master) $ git status\n> On branch master\n> Untracked files:\n>   (use \"git add <file>...\" to include in what will be committed)\n> \n> \tFoo/\n\nWhen git asks the filesystem lstat(\"foo\") to find out if we still have\nit, the filesystem returns the entry for \"Foo\" (because it is\ncase-insensitive).\n\nBut when git asks the filesystem to iterate over all of the files, so it\ncan check which ones are not tracked, it will get \"Foo\", which of course\nis not in the index.\n\nSo you do not see a deletion of \"foo\", but you do see \"Foo\" as\nuntracked.\n\n> 11:42:48 ~/test (master) $ git add .\n> 11:43:18 ~/test (master +) $ git commit -m \"second\"\n> [master f78d025] second\n>  1 file changed, 0 insertions(+), 0 deletions(-)\n>  create mode 100644 Foo/bar.md\n\nAnd this tells git to look through the filesystem for untracked files\nand add them to the index. So it adds \"Foo\".\n\nNow that you have both \"foo\" and \"Foo\" in the index, but the filesystem\ntreats them the same, you can create more mayhem. If you were to update\none entry but not the other (e.g., by writing to bar.md before doing the\nsecond commit), then git would be perpetually confused. _One_ of the\nfiles would always look like needed to be updated, because the\nfilesystem cannot represent the situation that is in the index.\n\nAnd that is why git sets core.ignorecase in the first place. :)\n\nAs to your original problem:\n\n> >> git isn’t tracking folder renames when the case of the letters\n> >> change, but it will track it if the folder changes names.  Is this\n> >> intentional?\n\nYes, this is intentional. Your filesystem treats them as the same file,\nso git has to, as well.\n\nIf your goal is to change the case that git records, then you should be\nable to do it with \"git mv\". But git will never pick up a case change\nthat you made separately in the filesystem, because it's\nindistinguishable from the filesystem simply picking a different case to\nstore the file.\n\nAnd that does happen. For instance, if you switch between two branches\nwith \"Foo\" and \"foo\", most case-preserving filesystems will leave you\nwith whichever version you had first (i.e., git asks the filesystem to\nopen \"foo\", and the filesystem says \"ah, I already have Foo; that must\nhave been what you meant\").\n\n-Peff\n"},{"id":"255562","messageId":"26FB4384-1027-436F-84C5-91C6CC4D27EA@sparkstart.io","threadId":"38489","inReplyTo":"20150203052317.GA1262@peff.net","subject":"Re: folder naming bug?","fromName":"Kevin Coleman","fromEmail":"kevin.coleman@sparkstart.io","sentAt":"2015-02-03T06:23:19Z","receivedAt":"2015-02-03T06:23:19Z","isPatch":false,"sender":{"key":"kevin.coleman@sparkstart.io","avatar":null},"body":"Awesome reply! That makes sense.  So basically if I accidentally capitalize a folder name and commit it, I need to be very careful when I correct it.  Definitely ran into this problem with my repo and ‘lost’ a few commits before I noticed something was off.\n\n-Kevin Coleman\n\n> On Feb 3, 2015, at 12:23 AM, Jeff King <peff@peff.net> wrote:\n> \n> On Mon, Feb 02, 2015 at 11:52:21PM -0500, Kevin Coleman wrote:\n> \n>> Yes, I am on a Mac.  I just tried that, but I don’t think that\n>> completely fixed it.  As you can see it tracks “foo/bar.md” and then\n>> it tracks “Foo/bar.md”.  It still tracks both “foo” and “Foo” even tho\n>> only “Foo” exists in my dir after the rename.\n> \n> Yes, because your filesystem _is_ case insensitive, but now you have\n> told git that it is not. In your example:\n> \n>> 11:41:57 ~/test $ git init\n>> Initialized empty Git repository in /Users/kcoleman/test/.git/\n>> 11:42:03 ~/test (master #) $ git config core.ignorecase false\n>> 11:42:06 ~/test (master #) $ mkdir foo\n>> 11:42:13 ~/test (master #) $ cd foo\n>> 11:42:26 ~/test/foo (master #) $ touch bar.md\n>> 11:42:30 ~/test/foo (master #) $ cd ..\n>> 11:42:32 ~/test (master #) $ git add .\n> \n> Now git has \"foo\" (lowercase) in the index. And that's what your\n> filesystem has, too.\n> \n>> 11:42:35 ~/test (master #) $ git commit -m \"first\"\n>> [master (root-commit) 6125a1d] first\n>> 1 file changed, 0 insertions(+), 0 deletions(-)\n>> create mode 100644 foo/bar.md\n>> 11:42:39 ~/test (master) $ mv foo Foo\n>> 11:42:44 ~/test (master) $ ls\n>> Foo\n> \n> Now we still have \"foo\" in the index, but \"Foo\" in the filesystem.\n> \n>> 11:42:46 ~/test (master) $ git status\n>> On branch master\n>> Untracked files:\n>>  (use \"git add <file>...\" to include in what will be committed)\n>> \n>> \tFoo/\n> \n> When git asks the filesystem lstat(\"foo\") to find out if we still have\n> it, the filesystem returns the entry for \"Foo\" (because it is\n> case-insensitive).\n> \n> But when git asks the filesystem to iterate over all of the files, so it\n> can check which ones are not tracked, it will get \"Foo\", which of course\n> is not in the index.\n> \n> So you do not see a deletion of \"foo\", but you do see \"Foo\" as\n> untracked.\n> \n>> 11:42:48 ~/test (master) $ git add .\n>> 11:43:18 ~/test (master +) $ git commit -m \"second\"\n>> [master f78d025] second\n>> 1 file changed, 0 insertions(+), 0 deletions(-)\n>> create mode 100644 Foo/bar.md\n> \n> And this tells git to look through the filesystem for untracked files\n> and add them to the index. So it adds \"Foo\".\n> \n> Now that you have both \"foo\" and \"Foo\" in the index, but the filesystem\n> treats them the same, you can create more mayhem. If you were to update\n> one entry but not the other (e.g., by writing to bar.md before doing the\n> second commit), then git would be perpetually confused. _One_ of the\n> files would always look like needed to be updated, because the\n> filesystem cannot represent the situation that is in the index.\n> \n> And that is why git sets core.ignorecase in the first place. :)\n> \n> As to your original problem:\n> \n>>>> git isn’t tracking folder renames when the case of the letters\n>>>> change, but it will track it if the folder changes names.  Is this\n>>>> intentional?\n> \n> Yes, this is intentional. Your filesystem treats them as the same file,\n> so git has to, as well.\n> \n> If your goal is to change the case that git records, then you should be\n> able to do it with \"git mv\". But git will never pick up a case change\n> that you made separately in the filesystem, because it's\n> indistinguishable from the filesystem simply picking a different case to\n> store the file.\n> \n> And that does happen. For instance, if you switch between two branches\n> with \"Foo\" and \"foo\", most case-preserving filesystems will leave you\n> with whichever version you had first (i.e., git asks the filesystem to\n> open \"foo\", and the filesystem says \"ah, I already have Foo; that must\n> have been what you meant\").\n> \n> -Peff\n"},{"id":"255563","messageId":"54D087FA.8030707@web.de","threadId":"38489","inReplyTo":"06E0624C-2484-476D-A32F-B586062EC230@sparkstart.io","subject":"Re: folder naming bug?","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2015-02-03T08:34:02Z","receivedAt":"2015-02-03T08:34:02Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"\nOn 02/03/2015 05:52 AM, Kevin Coleman wrote:\n> ====\n> Yes, I am on a Mac.  I just tried that, but I don’t think that completely fixed it.  As you can see it tracks “foo/bar.md” and then it tracks “Foo/bar.md”.  It still tracks both “foo” and “Foo” even tho only “Foo” exists in my dir after the rename.\nYou asked Git to track Foo/bar.md and the file system says \"yes, it's here\"\nWhen you rename Foo/ into foo/, the file system still says \"Foo/bar.md\" \nis here.\nYou need to tell git about the rename :\ngit mv Foo/bar.md foo/bar.md\n\nWhy does anybody think that setting \"core.ignorecase false\" will \nconvince the file system\nto become case insensitive ?\n"},{"id":"255564","messageId":"54D0897D.4050101@web.de","threadId":"38489","inReplyTo":"26FB4384-1027-436F-84C5-91C6CC4D27EA@sparkstart.io","subject":"Re: folder naming bug?","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2015-02-03T08:40:29Z","receivedAt":"2015-02-03T08:40:29Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 02/03/2015 07:23 AM, Kevin Coleman wrote:\n> Awesome reply! That makes sense.  So basically if I accidentally capitalize a folder name and commit it, I need to be very careful when I correct it.  Definitely ran into this problem with my repo and ‘lost’ a few commits before I noticed something was off.\n>\n> -Kevin Coleman\n(Please no top-posting)\n\nAccording to my experience setting core.ignorecase false\nmay cause the user to loose commits.\n\nCan you reproduce the problem ?\nwith core.ignorecase false (Which is wrong)\nwith core.ignorecase true (You shouldn't loose anything)\n"}]}