{"thread":{"id":"41189","subject":"[issue?]'git branch -D' case sensitive issue","startedAt":"2016-01-14T07:52:02Z","lastAt":"2016-01-15T22:28:00Z","messageCount":6,"participants":["郭腾飞","Torsten Bögershausen","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"276010","messageId":"CAB4fgE81JHzU=KmN9e=pjsurboipQ3K-pMu-26j+o+FU5G7tQQ@mail.gmail.com","threadId":"41189","inReplyTo":null,"subject":"[issue?]'git branch -D' case sensitive issue","fromName":"郭腾飞","fromEmail":"tfguo369@gmail.com","sentAt":"2016-01-14T07:52:02Z","receivedAt":"2016-01-14T07:52:02Z","isPatch":false,"sender":{"key":"tfguo369@gmail.com","avatar":null},"body":"Hi All,\nI encountered some issues when using 'git branch -D'.\nIt's strange, the command 'git branch -D' is case sensitive.\nHere is the operated log.\n\n➜  my-emacs-conf git:(NIce) git branch -avv\n* NIce                  fed5d9c Update js2-mode $ js-beautify.\n  master                fed5d9c [origin/master] Update js2-mode $ js-beautify.\n  remotes/origin/HEAD   -> origin/master\n  remotes/origin/fake   8ec9cad fake.\n  remotes/origin/mac13  13ae483 mac pro 13's config.\n  remotes/origin/master fed5d9c Update js2-mode $ js-beautify.\n➜  my-emacs-conf git:(NIce)\n➜  my-emacs-conf git:(NIce) git branch -D NIce\nerror: Cannot delete the branch 'NIce' which you are currently on.\n➜  my-emacs-conf git:(NIce)\n➜  my-emacs-conf git:(NIce) git branch -D NICe\nDeleted branch NICe (was fed5d9c).\n➜  my-emacs-conf git:(NIce) ✗ git branch -avv\n  master                fed5d9c [origin/master] Update js2-mode $ js-beautify.\n  remotes/origin/HEAD   -> origin/master\n  remotes/origin/fake   8ec9cad fake.\n  remotes/origin/mac13  13ae483 mac pro 13's config.\n  remotes/origin/master fed5d9c Update js2-mode $ js-beautify.\n\nHope someone can give me a hint.\n\n➜  my-emacs-conf git:(NIce) ✗ git --version\ngit version 2.6.3\n➜  my-emacs-conf git:(NIce) ✗ sw_vers -productVersion\n10.11 OSX\n\nBRs,\nterry3\n"},{"id":"276020","messageId":"56978BA9.2010005@web.de","threadId":"41189","inReplyTo":"CAB4fgE81JHzU=KmN9e=pjsurboipQ3K-pMu-26j+o+FU5G7tQQ@mail.gmail.com","subject":"Re: [issue?]'git branch -D' case sensitive issue","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2016-01-14T11:51:05Z","receivedAt":"2016-01-14T11:51:05Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 01/14/2016 08:52 AM, 郭腾飞 wrote:\n> Hi All,\n> I encountered some issues when using 'git branch -D'.\n> It's strange, the command 'git branch -D' is case sensitive.\n> Here is the operated log.\n>\n> ➜  my-emacs-conf git:(NIce) git branch -avv\n> * NIce                  fed5d9c Update js2-mode $ js-beautify.\n>    master                fed5d9c [origin/master] Update js2-mode $ js-beautify.\n>    remotes/origin/HEAD   -> origin/master\n>    remotes/origin/fake   8ec9cad fake.\n>    remotes/origin/mac13  13ae483 mac pro 13's config.\n>    remotes/origin/master fed5d9c Update js2-mode $ js-beautify.\n> ➜  my-emacs-conf git:(NIce)\n> ➜  my-emacs-conf git:(NIce) git branch -D NIce\n> error: Cannot delete the branch 'NIce' which you are currently on.\n> ➜  my-emacs-conf git:(NIce)\n> ➜  my-emacs-conf git:(NIce) git branch -D NICe\n> Deleted branch NICe (was fed5d9c).\n> ➜  my-emacs-conf git:(NIce) ✗ git branch -avv\n>    master                fed5d9c [origin/master] Update js2-mode $ js-beautify.\n>    remotes/origin/HEAD   -> origin/master\n>    remotes/origin/fake   8ec9cad fake.\n>    remotes/origin/mac13  13ae483 mac pro 13's config.\n>    remotes/origin/master fed5d9c Update js2-mode $ js-beautify.\n>\n> Hope someone can give me a hint.\n>\n> ➜  my-emacs-conf git:(NIce) ✗ git --version\n> git version 2.6.3\n> ➜  my-emacs-conf git:(NIce) ✗ sw_vers -productVersion\n> 10.11 OSX\n>\n> BRs,\n> terry3\n> --\nIf you can give us a hint, under which OS you are working ?\n\nI assume that you are on Windows or Mac OS ?\nIn this case the file system is part of the problem,\nwhich treats NIce and NICe the same.\n"},{"id":"276021","messageId":"CAB4fgE-UbTD6AkTaxyknJ+3ggtzRdYN43wgsamTXOYmGqDQ3_A@mail.gmail.com","threadId":"41189","inReplyTo":"56978BA9.2010005@web.de","subject":"Re: [issue?]'git branch -D' case sensitive issue","fromName":"郭腾飞","fromEmail":"tfguo369@gmail.com","sentAt":"2016-01-14T13:28:30Z","receivedAt":"2016-01-14T13:28:30Z","isPatch":false,"sender":{"key":"tfguo369@gmail.com","avatar":null},"body":"Hi Torsten Bögershausen, thank you for the quick reply.\nI'm working on Mac OS as I have mentioned in the previous email.\n\n➜  my-emacs-conf git:(NIce) ✗ sw_vers -productVersion\n10.11 OSX\n\nAnd besides, I use a case sensitive file system in OSX through the command\n'hdiutil create -volname 'case_fs' -type SPARSE -fs 'Case-sensitive\nJournaled HFS+' -size 100g ~/case_fs.sparseimage'\nIs this a known issue?\nThank you!\n\nBRs\nterry3\n\n2016-01-14 19:51 GMT+08:00 Torsten Bögershausen <tboegi@web.de>:\n> On 01/14/2016 08:52 AM, 郭腾飞 wrote:\n>>\n>> Hi All,\n>> I encountered some issues when using 'git branch -D'.\n>> It's strange, the command 'git branch -D' is case sensitive.\n>> Here is the operated log.\n>>\n>> ➜  my-emacs-conf git:(NIce) git branch -avv\n>> * NIce                  fed5d9c Update js2-mode $ js-beautify.\n>>    master                fed5d9c [origin/master] Update js2-mode $\n>> js-beautify.\n>>    remotes/origin/HEAD   -> origin/master\n>>    remotes/origin/fake   8ec9cad fake.\n>>    remotes/origin/mac13  13ae483 mac pro 13's config.\n>>    remotes/origin/master fed5d9c Update js2-mode $ js-beautify.\n>> ➜  my-emacs-conf git:(NIce)\n>> ➜  my-emacs-conf git:(NIce) git branch -D NIce\n>> error: Cannot delete the branch 'NIce' which you are currently on.\n>> ➜  my-emacs-conf git:(NIce)\n>> ➜  my-emacs-conf git:(NIce) git branch -D NICe\n>> Deleted branch NICe (was fed5d9c).\n>> ➜  my-emacs-conf git:(NIce) ✗ git branch -avv\n>>    master                fed5d9c [origin/master] Update js2-mode $\n>> js-beautify.\n>>    remotes/origin/HEAD   -> origin/master\n>>    remotes/origin/fake   8ec9cad fake.\n>>    remotes/origin/mac13  13ae483 mac pro 13's config.\n>>    remotes/origin/master fed5d9c Update js2-mode $ js-beautify.\n>>\n>> Hope someone can give me a hint.\n>>\n>> ➜  my-emacs-conf git:(NIce) ✗ git --version\n>> git version 2.6.3\n>> ➜  my-emacs-conf git:(NIce) ✗ sw_vers -productVersion\n>> 10.11 OSX\n>>\n>> BRs,\n>> terry3\n>> --\n>\n> If you can give us a hint, under which OS you are working ?\n>\n> I assume that you are on Windows or Mac OS ?\n> In this case the file system is part of the problem,\n> which treats NIce and NICe the same.\n>\n\n\n\n-- \n\n________________________________\nGuo Tengfei\n"},{"id":"276046","messageId":"5697CFEB.4090308@web.de","threadId":"41189","inReplyTo":"CAB4fgE-UbTD6AkTaxyknJ+3ggtzRdYN43wgsamTXOYmGqDQ3_A@mail.gmail.com","subject":"Re: [issue?]'git branch -D' case sensitive issue","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2016-01-14T16:42:19Z","receivedAt":"2016-01-14T16:42:19Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 14.01.16 14:28, 郭腾飞 wrote:\nPlease no top-posting on this list.\n> Hi Torsten Bögershausen, thank you for the quick reply.\n> I'm working on Mac OS as I have mentioned in the previous email.\n> \n> ➜  my-emacs-conf git:(NIce) ✗ sw_vers -productVersion\n> 10.11 OSX\n> \n> And besides, I use a case sensitive file system in OSX through the command\n> 'hdiutil create -volname 'case_fs' -type SPARSE -fs 'Case-sensitive\n> Journaled HFS+' -size 100g ~/case_fs.sparseimage'\n> Is this a known issue?\n> Thank you!\n> \n> BRs\n> terry3\n\nNo, this is typically what we observe on a case insensitive FS.\nAnd that make me wonder what\ngit config core.ignorecase\nsays ?\n"},{"id":"276059","messageId":"xmqq4megkrf9.fsf@gitster.mtv.corp.google.com","threadId":"41189","inReplyTo":"5697CFEB.4090308@web.de","subject":"Re: [issue?]'git branch -D' case sensitive issue","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-01-14T17:21:46Z","receivedAt":"2016-01-14T17:21:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Torsten Bögershausen <tboegi@web.de> writes:\n\n> No, this is typically what we observe on a case insensitive FS.\n\nThere is an interesting bit in delete_branches::builtin/branch.c\n\n\tif (kinds == FILTER_REFS_BRANCHES && !strcmp(head, bname.buf)) {\n\t\terror(_(\"Cannot delete the branch '%s' \"\n\t\t      \"which you are currently on.\"), bname.buf);\n\t\tret = 1;\n\t\tcontinue;\n\t}\n\nThe strcmp() does not protect you from attempting to remove \"FrOtZ\"\nbranch when you are on (and more importantly, Git thinks you are on)\n\"frotz\" branch.  A case-insensitive system then can tell Git that\nthe request to remove \"refs/heads/FrOtZ\" succeeded, even though in\nreality it didn't have such file, and silently \"refs/heads/frotz\"\ngets removed instead.  You can end up removing your current branch\nthat way.\n"},{"id":"276212","messageId":"20160115222800.GA32081@sigill.intra.peff.net","threadId":"41189","inReplyTo":"xmqq4megkrf9.fsf@gitster.mtv.corp.google.com","subject":"Re: [issue?]'git branch -D' case sensitive issue","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-01-15T22:28:00Z","receivedAt":"2016-01-15T22:28:00Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 14, 2016 at 09:21:46AM -0800, Junio C Hamano wrote:\n\n> Torsten Bögershausen <tboegi@web.de> writes:\n> \n> > No, this is typically what we observe on a case insensitive FS.\n> \n> There is an interesting bit in delete_branches::builtin/branch.c\n> \n> \tif (kinds == FILTER_REFS_BRANCHES && !strcmp(head, bname.buf)) {\n> \t\terror(_(\"Cannot delete the branch '%s' \"\n> \t\t      \"which you are currently on.\"), bname.buf);\n> \t\tret = 1;\n> \t\tcontinue;\n> \t}\n> \n> The strcmp() does not protect you from attempting to remove \"FrOtZ\"\n> branch when you are on (and more importantly, Git thinks you are on)\n> \"frotz\" branch.  A case-insensitive system then can tell Git that\n> the request to remove \"refs/heads/FrOtZ\" succeeded, even though in\n> reality it didn't have such file, and silently \"refs/heads/frotz\"\n> gets removed instead.  You can end up removing your current branch\n> that way.\n\nThis seemed eerily familiar. And indeed, there's some discussion in:\n\n  http://article.gmane.org/gmane.comp.version-control.git/276506\n\nChanging that strcmp to strcmp_icase() is still wrong, though I suspect\nit's less wrong in practice (and errs on the side of caution). But I\nthink there are probably a lot of similar problems lurking.\n\n-Peff\n"}]}