{"thread":{"id":"42543","subject":"Minor Bug in Renaming Branches","startedAt":"2016-06-06T17:52:55Z","lastAt":"2016-06-07T13:09:09Z","messageCount":7,"participants":["Samuel Lijin","Stefan Beller","Torsten Bögershausen","Eric Deplagne"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"288463","messageId":"CA+wHs3MSax1eo9V_5hnsbEte0k5tX22dAgSUAEzN7aw22rUnhA@mail.gmail.com","threadId":"42543","inReplyTo":null,"subject":"Minor Bug in Renaming Branches","fromName":"Samuel Lijin","fromEmail":"samuel.lijin@formlabs.com","sentAt":"2016-06-06T17:52:55Z","receivedAt":"2016-06-06T17:52:55Z","isPatch":false,"sender":{"key":"samuel.lijin@formlabs.com","avatar":null},"body":"Hi,\n\nNot quite sure where to submit bug reports about Git, this was the\nbest I could find, so if there's a better place to do this, please let\nme know and I will.\n\nThe short of this issue is that on Mac and Windows, if a branch has a\nslash in its name, changing it from lowercase to uppercase requires\ndiving into .git/refs/heads/ and manually moving stuff around - I\nthink the behavior should be at least something like this:\nhttp://stackoverflow.com/questions/26810252/how-to-change-my-local-github-branch-name-to-uppercase.\n\nIt happens that on both Windows box, to rename a branch from\n\"branch/name\" to \"BRANCH/NAME\", one has to actually dive into\n.git/refs/heads/ because of how Windows handles upper/lowercase in\ndirectory paths. (Win7, mingw64 via Git for Bash, git version\n2.7.0.windows.1)\nuser@windows-box MINGW64 ~\n$ mkdir sandbox && cd sandbox && git init\nInitialized empty Git repository in C:/Users/user/sandbox/.git/\nuser@windows-box MINGW64 ~/sandbox (master)\n$ touch empty.txt && git add empty.txt && git commit -m 'initialize repo'\n[master (root-commit) 761113d] initialize repo\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 empty.txt\nuser@windows-box MINGW64 ~/sandbox (master)\n$ git branch\n* master\nuser@windows-box MINGW64 ~/sandbox (master)\n$ git checkout -b branch/name\nSwitched to a new branch 'branch/name'\nuser@windows-box MINGW64 ~/sandbox (branch/name)\n$ git branch\n* branch/name\n  master\nuser@windows-box MINGW64 ~/sandbox (branch/name)\n$ git branch -m BRANCH/NAME\nfatal: A branch named 'BRANCH/NAME' already exists.\nuser@windows-box MINGW64 ~/sandbox (branch/name)\n$ git branch -m tmp\nuser@windows-box MINGW64 ~/sandbox (tmp)\n$ git branch -m BRANCH/NAME\nuser@windows-box MINGW64 ~/sandbox (BRANCH/NAME)\n$ git branch\n  branch/NAME\n  master\nuser@windows-box MINGW64 ~/sandbox (BRANCH/NAME)\n$ mv .git/refs/heads/branch/ .git/refs/heads/BRANCH/\nuser@windows-box MINGW64 ~/sandbox (BRANCH/NAME)\n$ git branch\n* BRANCH/NAME\n  master\n\nInterestingly, from inside an Ubuntu VM (with the directory in\nquestion mounted as a VBox fileshare), this is not an issue.\n\nA colleague on a Mac also reproduces the issue successfully (OSX\n10.11.5, git 2.8.3):\n\nmac-box:sandbox user$ touch empty.txt && git add empty.txt && git\ncommit -m 'initial commit'\n[master (root-commit) 1f4f1fa] initial commit\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 empty.txt\nmac-box:sandbox user$ git branch\n* master\nmac-box:sandbox user$ git checkout -b branch/name\nSwitched to a new branch 'branch/name'\nmac-box:sandbox user$ git branch -m BRANCH/NAME\nfatal: A branch named 'BRANCH/NAME' already exists.\nmac-box:sandbox user$ git branch\n* branch/name\n  master\nmac-box:sandbox user$ git branch -m tmp\nmac-box:sandbox user$ git branch\n  master\n* tmp\nmac-box:sandbox user$ git branch -m BRANCH/NAME\nmac-box:sandbox user$ git branch\n  branch/NAME\n  master\nmac-box:sandbox user$ mv .git/refs/heads/branch/ .git/refs/heads/BRANCH/\nmac-box:sandbox user$ git branch\n* BRANCH/NAME\n  master\n\nThanks,\nSam\n"},{"id":"288467","messageId":"CAGZ79kZg_ZjBS4gB+P68J+mpzGqkPNW+5NdrRiHmA0uC235RBQ@mail.gmail.com","threadId":"42543","inReplyTo":"CA+wHs3MSax1eo9V_5hnsbEte0k5tX22dAgSUAEzN7aw22rUnhA@mail.gmail.com","subject":"Re: Minor Bug in Renaming Branches","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-06-06T18:09:37Z","receivedAt":"2016-06-06T18:09:37Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Jun 6, 2016 at 10:52 AM, Samuel Lijin <samuel.lijin@formlabs.com> wrote:\n> user@windows-box MINGW64 ~/sandbox (branch/name)\n> $ git branch -m BRANCH/NAME\n> fatal: A branch named 'BRANCH/NAME' already exists.\n\nYeah, branches/refs are treated as if they are files on a file system\n(which they are currently). So depending on the file system used\nyou have problems with case sensitive things.\n"},{"id":"288473","messageId":"54505ef2-7db6-8bc4-0ffb-0ac28c7d6046@web.de","threadId":"42543","inReplyTo":"CA+wHs3MSax1eo9V_5hnsbEte0k5tX22dAgSUAEzN7aw22rUnhA@mail.gmail.com","subject":"Re: Minor Bug in Renaming Branches","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2016-06-06T19:17:25Z","receivedAt":"2016-06-06T19:17:25Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 06.06.16 19:52, Samuel Lijin wrote:\n> Hi,\n> \n> Not quite sure where to submit bug reports about Git, this was the\n> best I could find, so if there's a better place to do this, please let\n> me know and I will.\n> \n> The short of this issue is that on Mac and Windows, if a branch has a\n> slash in its name, changing it from lowercase to uppercase requires\n> diving into .git/refs/heads/ and manually moving stuff around - I\n> think the behavior should be at least something like this:\n> http://stackoverflow.com/questions/26810252/how-to-change-my-local-github-branch-name-to-uppercase.\n> \n> It happens that on both Windows box, to rename a branch from\n> \"branch/name\" to \"BRANCH/NAME\", one has to actually dive into\n> .git/refs/heads/ because of how Windows handles upper/lowercase in\n> directory paths. (Win7, mingw64 via Git for Bash, git version\n> 2.7.0.windows.1)\n> user@windows-box MINGW64 ~\n> $ mkdir sandbox && cd sandbox && git init\n> Initialized empty Git repository in C:/Users/user/sandbox/.git/\n> user@windows-box MINGW64 ~/sandbox (master)\n> $ touch empty.txt && git add empty.txt && git commit -m 'initialize repo'\n> [master (root-commit) 761113d] initialize repo\n>  1 file changed, 0 insertions(+), 0 deletions(-)\n>  create mode 100644 empty.txt\n> user@windows-box MINGW64 ~/sandbox (master)\n> $ git branch\n> * master\n> user@windows-box MINGW64 ~/sandbox (master)\n> $ git checkout -b branch/name\n> Switched to a new branch 'branch/name'\n> user@windows-box MINGW64 ~/sandbox (branch/name)\n> $ git branch\n> * branch/name\n>   master\n> user@windows-box MINGW64 ~/sandbox (branch/name)\n> $ git branch -m BRANCH/NAME\n> fatal: A branch named 'BRANCH/NAME' already exists.\n> user@windows-box MINGW64 ~/sandbox (branch/name)\n> $ git branch -m tmp\n> user@windows-box MINGW64 ~/sandbox (tmp)\n> $ git branch -m BRANCH/NAME\n> user@windows-box MINGW64 ~/sandbox (BRANCH/NAME)\n> $ git branch\n>   branch/NAME\n>   master\n> user@windows-box MINGW64 ~/sandbox (BRANCH/NAME)\n> $ mv .git/refs/heads/branch/ .git/refs/heads/BRANCH/\n> user@windows-box MINGW64 ~/sandbox (BRANCH/NAME)\n> $ git branch\n> * BRANCH/NAME\n>   master\n> \n> Interestingly, from inside an Ubuntu VM (with the directory in\n> question mounted as a VBox fileshare), this is not an issue.\n> \n> A colleague on a Mac also reproduces the issue successfully (OSX\n> 10.11.5, git 2.8.3):\n> \n> mac-box:sandbox user$ touch empty.txt && git add empty.txt && git\n> commit -m 'initial commit'\n> [master (root-commit) 1f4f1fa] initial commit\n>  1 file changed, 0 insertions(+), 0 deletions(-)\n>  create mode 100644 empty.txt\n> mac-box:sandbox user$ git branch\n> * master\n> mac-box:sandbox user$ git checkout -b branch/name\n> Switched to a new branch 'branch/name'\n> mac-box:sandbox user$ git branch -m BRANCH/NAME\n> fatal: A branch named 'BRANCH/NAME' already exists.\n> mac-box:sandbox user$ git branch\n> * branch/name\n>   master\n> mac-box:sandbox user$ git branch -m tmp\n> mac-box:sandbox user$ git branch\n>   master\n> * tmp\n> mac-box:sandbox user$ git branch -m BRANCH/NAME\n> mac-box:sandbox user$ git branch\n>   branch/NAME\n>   master\n> mac-box:sandbox user$ mv .git/refs/heads/branch/ .git/refs/heads/BRANCH/\n> mac-box:sandbox user$ git branch\n> * BRANCH/NAME\n>   master\n> \n> Thanks,\n> Sam\nA limitation is introduced by Mac OS and Windows:\nBRANCH/NAME and branch/name refer to the same object in the file\nsystem.\nAs a workaround, you can pack the branch names:\ngit pack-refs --all\nor, \nthat is my preference, avoid using the same name upper- and\nlower-case.\n\n\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> \n"},{"id":"288478","messageId":"CAGZ79kb77m8ymDkJGMaWi8yOdSphpYifDPHQ=+nZMBhRi47i9w@mail.gmail.com","threadId":"42543","inReplyTo":"54505ef2-7db6-8bc4-0ffb-0ac28c7d6046@web.de","subject":"Re: Minor Bug in Renaming Branches","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-06-06T19:35:25Z","receivedAt":"2016-06-06T19:35:25Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Jun 6, 2016 at 12:17 PM, Torsten Bögershausen <tboegi@web.de> wrote:\n\n> A limitation is introduced by Mac OS and Windows:\n> BRANCH/NAME and branch/name refer to the same object in the file\n> system.\n> As a workaround, you can pack the branch names:\n> git pack-refs --all\n\n\nOnce you packed a branch into the packed refs file, you can\ncreate another loose branch of different capitalization,\nwhich then 'hides' the packed ref?\n\nThat sounds error prone to me, as a seemingly unrelated branch\nchanged its value:\n\n    git branch BRANCH 012345\n    git pack-refs --all\n    git branch branch BRANCH^\n    git rev-parse BRANCH\n    (I'd expect BRANCH^ as return)\n\n(I don't have a windows machine for testing here, so that\nis pure speculation)\n\nThanks,\nStefan\n"},{"id":"288514","messageId":"575649DA.4080702@web.de","threadId":"42543","inReplyTo":"CAGZ79kb77m8ymDkJGMaWi8yOdSphpYifDPHQ=+nZMBhRi47i9w@mail.gmail.com","subject":"Re: Minor Bug in Renaming Branches","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2016-06-07T04:13:14Z","receivedAt":"2016-06-07T04:13:14Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 06/06/2016 09:35 PM, Stefan Beller wrote:\n> On Mon, Jun 6, 2016 at 12:17 PM, Torsten Bögershausen <tboegi@web.de> wrote:\n>\n>> A limitation is introduced by Mac OS and Windows:\n>> BRANCH/NAME and branch/name refer to the same object in the file\n>> system.\n>> As a workaround, you can pack the branch names:\n>> git pack-refs --all\n>\n> Once you packed a branch into the packed refs file, you can\n> create another loose branch of different capitalization,\n> which then 'hides' the packed ref?\n>\n> That sounds error prone to me, as a seemingly unrelated branch\n> changed its value:\n>\n>      git branch BRANCH 012345\n>      git pack-refs --all\n>      git branch branch BRANCH^\n>      git rev-parse BRANCH\n>      (I'd expect BRANCH^ as return)\n>\n> (I don't have a windows machine for testing here, so that\n> is pure speculation)\n>\nYes, another reason not to use branch and BRANCH in the same repo.\n(You can test under Linux & vfat)\n"},{"id":"288534","messageId":"20160607074051.GT22583@mail.eric.deplagne.name","threadId":"42543","inReplyTo":"575649DA.4080702@web.de","subject":"Re: Minor Bug in Renaming Branches","fromName":"Eric Deplagne","fromEmail":"eric@deplagne.name","sentAt":"2016-06-07T07:40:51Z","receivedAt":"2016-06-07T07:40:51Z","isPatch":false,"sender":{"key":"eric@deplagne.name","avatar":null},"body":"On Tue, 07 Jun 2016 06:13:14 +0200, Torsten Bögershausen wrote:\n> On 06/06/2016 09:35 PM, Stefan Beller wrote:\n>> On Mon, Jun 6, 2016 at 12:17 PM, Torsten Bögershausen <tboegi@web.de> wrote:\n>>\n>>> A limitation is introduced by Mac OS and Windows:\n>>> BRANCH/NAME and branch/name refer to the same object in the file\n>>> system.\n>>> As a workaround, you can pack the branch names:\n>>> git pack-refs --all\n>>\n>> Once you packed a branch into the packed refs file, you can\n>> create another loose branch of different capitalization,\n>> which then 'hides' the packed ref?\n>>\n>> That sounds error prone to me, as a seemingly unrelated branch\n>> changed its value:\n>>\n>>      git branch BRANCH 012345\n>>      git pack-refs --all\n>>      git branch branch BRANCH^\n>>      git rev-parse BRANCH\n>>      (I'd expect BRANCH^ as return)\n>>\n>> (I don't have a windows machine for testing here, so that\n>> is pure speculation)\n>>\n> Yes, another reason not to use branch and BRANCH in the same repo.\n> (You can test under Linux & vfat)\n\n  Or to have git just refuse it altogether...\n\n  But let me guess, it's against some sort of policy...\n\n  There could be some hook out there, then ?\n\n-- \n  Eric Deplagne\n"},{"id":"288597","messageId":"CAGZ79kaDAPAkkEWVS6pEuAxoWht5Z5GmKjs1ii9_bsTViyhnVQ@mail.gmail.com","threadId":"42543","inReplyTo":"20160607074051.GT22583@mail.eric.deplagne.name","subject":"Re: Minor Bug in Renaming Branches","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-06-07T13:09:09Z","receivedAt":"2016-06-07T13:09:09Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, Jun 7, 2016 at 12:40 AM, Eric Deplagne <Eric@deplagne.name> wrote:\n> On Tue, 07 Jun 2016 06:13:14 +0200, Torsten Bögershausen wrote:\n>> On 06/06/2016 09:35 PM, Stefan Beller wrote:\n>>> On Mon, Jun 6, 2016 at 12:17 PM, Torsten Bögershausen <tboegi@web.de> wrote:\n>>>\n>>>> A limitation is introduced by Mac OS and Windows:\n>>>> BRANCH/NAME and branch/name refer to the same object in the file\n>>>> system.\n>>>> As a workaround, you can pack the branch names:\n>>>> git pack-refs --all\n>>>\n>>> Once you packed a branch into the packed refs file, you can\n>>> create another loose branch of different capitalization,\n>>> which then 'hides' the packed ref?\n>>>\n>>> That sounds error prone to me, as a seemingly unrelated branch\n>>> changed its value:\n>>>\n>>>      git branch BRANCH 012345\n>>>      git pack-refs --all\n>>>      git branch branch BRANCH^\n>>>      git rev-parse BRANCH\n>>>      (I'd expect BRANCH^ as return)\n>>>\n>>> (I don't have a windows machine for testing here, so that\n>>> is pure speculation)\n>>>\n>> Yes, another reason not to use branch and BRANCH in the same repo.\n>> (You can test under Linux & vfat)\n>\n>   Or to have git just refuse it altogether...\n\nMaybe we could refuse creation of case different branch\nnames on case insensitive file systems, but you could have\ncreated them on a case sensitive file system, so you still\nhave to work with that.\n\nThis topic was discussed at the Git Merge this year (again),\nand IIRC the outcome was to not restrict outselves to the\nlowest common denominator, but rather ¯\\_(ツ)_/¯.\nPeople who use case insensitive file systems are aware of\ntheir limitations and would not ever want to do such branch\ntricks, right? ;)\n\n\n>\n>   But let me guess, it's against some sort of policy...\n\nI rather think nobody stepped up to present a\nsolution that doesn't suck. As by the title of this thread,\nit's rather minor.\n\n>\n>   There could be some hook out there, then ?\n\nThe hook to tell the user if that branch name is allowed?\n\nMy gut reaction to that is, that such a hook would violate\nthe principles of the DVCS thinking. A user ought\nto do anything they want locally including having naming\nrights for their local branches, so we'd not want to restrict\nthem?\n\n>\n> --\n>   Eric Deplagne\n>\n> -----BEGIN PGP SIGNATURE-----\n> Version: GnuPG v1.4.9 (GNU/Linux)\n>\n> iD4DBQFXVnqDej7DisjVpq4RAqxoAJ0eufoN3OXWKGiHrAPolS4SmOHGIwCWJHNl\n> jI/aVh12/NM8YZX5oEl4Ww==\n> =rwxP\n> -----END PGP SIGNATURE-----\n>\n"}]}